I've ask the same question befere, here is the answer from Simone, and
that give me lots of help, I hope it can help you too:


> 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
>
> <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"<http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>
>
> <http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>

... As you can see, i customized compilem, test-compile and test
phases<http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>
>
> <http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>

- In projects packaged with you custom packages you have to
:<http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>
>
> <http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>

... Set <packaging> to your packaging
name<http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>
>
> <http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>

... Include you plugin in the plugins section of the pom,
specifying<http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>
>
> <http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>

<extensions>true</extensions><http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>
>
> <http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>

... You can find an example of a package using my custom packaging
here<http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>
>
> <http://svn.apache.org/repos/asf/labs/magma/trunk/maven-magma-plugin/src/main/resources/META-INF/plexus/components.xml>

http://svn.apache.org/repos/asf/labs/magma/trunk/foundation-basics/pom.xml
>
> <http://svn.apache.org/repos/asf/labs/magma/trunk/foundation-basics/pom.xml>

...... Maybe this last step could be avoidable somehow? maybe using
some<http://svn.apache.org/repos/asf/labs/magma/trunk/foundation-basics/pom.xml>
>
> <http://svn.apache.org/repos/asf/labs/magma/trunk/foundation-basics/pom.xml>

naming 
convention?<http://svn.apache.org/repos/asf/labs/magma/trunk/foundation-basics/pom.xml>
>
> <http://svn.apache.org/repos/asf/labs/magma/trunk/foundation-basics/pom.xml>


> 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
>

2008/10/16 Martijn Morriën <[EMAIL PROTECTED]>

> Dear Maven users, I have 2 questions:
>
> 1) Can I query the archived mailinglists? I can browse the archives
> (http://mail-archives.apache.org/mod_mbox/maven-users/), but cannot
> seem to find a way to search through them.
>
> 2) I would like to create my own packaging type, with my own life
> cycle. How can I achieve this? Is this documented somewhere?
> I found some documentation in "Specifying a New Packaging" on
>
> http://www.propellors.net/maven/site/guides/introduction/introduction-to-the-lifecycle.html
> ,
> but this is incomplete and it is no longer available on
>
> http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
> .
>
> Thank you,
>
> Martijn
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to