You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by 陈思淼 <ch...@gmail.com> on 2008/09/26 10:28:33 UTC

Someone know Maven core Mechanism please help.

I want to define a new packaging type called jcar to package my own project.
I traced the source core of maven and that the Maven-core will look up for
componentManagerManager by the key
"org.apache.maven.lifecycle.mapping.LifecycleMapping"+packaging_type,
Im sure the default packaging type "jar,ear,rar" for example, have
registered to the PlexusContainer. but I don't know how and when to
registered that LifecycleMapping componentManager to the container? and how
I can I do it myself?
Is there Maven plugin developer can tell me some detail about this?
Thank you very Much.

Re: Someone know Maven core Mechanism please help.

Posted by 陈思淼 <ch...@gmail.com>.
Thanks a million. you have help me a lot, if it possible I will treat you a
dinner :-) .

2008/9/26 Simone Gianni <si...@apache.org>

> Hi 陈思淼,
> I'm not a Maven developer but I did a custom packaging. You have to
> follow these steps :
> - Create a plugin (mojo) project
> - In this plugin project, define your plugins, with their goals. For
> example, one of them could be jcar-compile
> - In the src/main/resources of your plugin, create the folder
> META-INF/plexus/
> - In this folder, create a file components.xml
> - In this file, you can add directives to the Plexus container. The
> syntax is nearly the same used in Avalon, if you ever used Avalon or
> Cocoon 2.1 you should be familiar with it.
> - In our case, you can declare which phases are required for your custom
> packaging type, and the binding between phases and plugins (either the
> default one and your custom).
> - You can find the components.xml for my custom packaging here
>
> http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml
> ... In my case my packaging name is "magma"
> ... As you can see, i customized compilem, test-compile and test phases
> - In projects packaged with you custom packages you have to :
> ... Set <packaging> to your packaging name
> ... Include you plugin in the plugins section of the pom, specifying
> <extensions>true</extensions>
> ... You can find an example of a package using my custom packaging here
> http://svn.apache.org/repos/asf/labs/magma/trunk/foundation-basics/pom.xml
> ...... Maybe this last step could be avoidable somehow? maybe using some
> naming convention?
>
> At this point, install your plugin, and try to install an artifact using
> your custom packaging.
>
> I'm pretty sure I forgot something important, but this should at least
> give you a starting point.
>
> Unfortunately I cannot remember where I found this informations, but
> there is a guide somewhere on the Maven site.
>
> Hope this helps,
> Simone
>
>
>
> 陈思淼 wrote:
> > I want to define a new packaging type called jcar to package my own
> project.
> > I traced the source core of maven and that the Maven-core will look up
> for
> > componentManagerManager by the key
> > "org.apache.maven.lifecycle.mapping.LifecycleMapping"+packaging_type,
> > Im sure the default packaging type "jar,ear,rar" for example, have
> > registered to the PlexusContainer. but I don't know how and when to
> > registered that LifecycleMapping componentManager to the container? and
> how
> > I can I do it myself?
> > Is there Maven plugin developer can tell me some detail about this?
> > Thank you very Much.
> >
> >
>
>
> --
> Simone Gianni            CEO Semeru s.r.l.           Apache Committer
> MALE human being programming a computer   http://www.simonegianni.it/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: Someone know Maven core Mechanism please help.

Posted by Simone Gianni <si...@apache.org>.
Hi 陈思淼,
I'm not a Maven developer but I did a custom packaging. You have to
follow these steps :
- Create a plugin (mojo) project
- In this plugin project, define your plugins, with their goals. For
example, one of them could be jcar-compile
- In the src/main/resources of your plugin, create the folder
META-INF/plexus/
- In this folder, create a file components.xml
- In this file, you can add directives to the Plexus container. The
syntax is nearly the same used in Avalon, if you ever used Avalon or
Cocoon 2.1 you should be familiar with it.
- In our case, you can declare which phases are required for your custom
packaging type, and the binding between phases and plugins (either the
default one and your custom).
- You can find the components.xml for my custom packaging here
http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml
... In my case my packaging name is "magma"
... As you can see, i customized compilem, test-compile and test phases
- In projects packaged with you custom packages you have to :
... Set <packaging> to your packaging name
... Include you plugin in the plugins section of the pom, specifying
<extensions>true</extensions>
... You can find an example of a package using my custom packaging here
http://svn.apache.org/repos/asf/labs/magma/trunk/foundation-basics/pom.xml
...... Maybe this last step could be avoidable somehow? maybe using some
naming convention?

At this point, install your plugin, and try to install an artifact using
your custom packaging.

I'm pretty sure I forgot something important, but this should at least
give you a starting point.

Unfortunately I cannot remember where I found this informations, but
there is a guide somewhere on the Maven site.

Hope this helps,
Simone



陈思淼 wrote:
> I want to define a new packaging type called jcar to package my own project.
> I traced the source core of maven and that the Maven-core will look up for
> componentManagerManager by the key
> "org.apache.maven.lifecycle.mapping.LifecycleMapping"+packaging_type,
> Im sure the default packaging type "jar,ear,rar" for example, have
> registered to the PlexusContainer. but I don't know how and when to
> registered that LifecycleMapping componentManager to the container? and how
> I can I do it myself?
> Is there Maven plugin developer can tell me some detail about this?
> Thank you very Much.
>
>   


-- 
Simone Gianni            CEO Semeru s.r.l.           Apache Committer
MALE human being programming a computer   http://www.simonegianni.it/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org