On Wed, Oct 14, 2009 at 13:52, Tony Chemit <che...@codelutin.com> wrote:

> Le Wed, 14 Oct 2009 13:15:35 +0200,
> Tony Chemit <che...@codelutin.com> a écrit :
>
> > Le Wed, 14 Oct 2009 13:02:20 +0200,
> > Martijn Morriën <dj.es...@gmail.com> a écrit :
> >
> > > On Wed, Oct 14, 2009 at 12:40, Tony Chemit <che...@codelutin.com>
> wrote:
> > >
> > > > Le Wed, 14 Oct 2009 12:30:28 +0200,
> > > > Martijn Morriën <dj.es...@gmail.com> a écrit :
> > > >
> > > > > Hi,
> > > > >
> > > > > I'm writing a mojo that generates source files. Is it possible to
> get
> > > > > rid
> > > > of
> > > > > the required executions part in the pom?
> > > > > My mojo already defines it should be used in the generate-sources
> phase.
> > > > And
> > > > > my plugin only contains 1 mojo.
> > > > >
> > > > > /**
> > > > >  * @goal mycodegenerator
> > > > >  * @phase generate-sources
> > > > >  * @requiresProject false
> > > > >  */
> > > > > public class MyCodeGenerator extends AbstractMojo
> > > > >
> > > > > I use it as follows:
> > > > >
> > > > >   <build>
> > > > >     <plugins>
> > > > >       <plugin>
> > > > >         <groupId>mytest</groupId>
> > > > >         <artifactId>mycodegenerator</artifactId>
> > > > >         <version>0.0.1-SNAPSHOT</version>
> > > > >         <executions>
> > > > >           <execution>
> > > > >             <goals>
> > > > >               <goal>mycodegenerator</goal>
> > > > >             </goals>
> > > > >           </execution>
> > > > >         </executions>
> > > > >       </plugin>
> > > > >     </plugins>
> > > > >   </build>
> > > > >
> > > > > I would prefer to us it as follows, but it doesn't work for me:
> > > > >
> > > > >   <build>
> > > > >     <plugins>
> > > > >       <plugin>
> > > > >         <groupId>mytest</groupId>
> > > > >         <artifactId>mycodegenerator</artifactId>
> > > > >         <version>0.0.1-SNAPSHOT</version>
> > > > >       </plugin>
> > > > >     </plugins>
> > > > >   </build>
> > > > >
> > > > > Is this possible? I do not want to introduce a new packaging type.
> > > > >
> > > > > Thank you, Martijn
> > > >
> > > > You want to modify the default lifecycle mappings to integrate your
> goal
> > > > for a given phase.
> > > >
> > > > The lifecycle is explained in the maven guide [1] .
> > > >
> > > > Have a look at [2] which explain how to do this.
> > > >
> > > > Tony.
> > > >
> > > > [1]
> http://www.sonatype.com/books/maven-book/reference/lifecycle.html
> > > >
> > > > [2]
> > > >
> http://www.sonatype.com/people/2009/08/create-a-customized-build-process-in-maven/
> > > >
> > > > --
> > > >
> > > > Tony Chemit
> > > > --------------------
> > > > tél: +33 (0) 2 40 50 29 28
> > > > email: che...@codelutin.com
> > > > http://www.codelutin.com
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > > > For additional commands, e-mail: users-h...@maven.apache.org
> > > >
> > > >
> > > Thank you Tony,
> > >
> > > I've looked and tested my own lifecycle definition, however it requires
> the
> > > change of a packaging type. or am I wrong?
> > > I do not want to change the packaging type. So should I redefine
> existing
> > > packaging types I want to support?
> > > E.g. if I want to support <packaging>jar<packaging>, is it allowed to
> use
> > > <role-hint>jar</role-hint> ?
> > I don't known in fact (I have not done this yet :)), but it must be able
> to
> > use the jar role-hint in the default lifecycle ?
> >
> Sorry for the false hope... It seems not to be able to override an already
> defined lifecycle.
>
> My idea was to override the default lifecycle for the jar role-hint (I just
> try it and it does not works...)
>
> Moreover I read in [3] this :
>
> <!-- TODO: issues with the lifecycle:
>     - manually configured lifecycles will not pick up any later additions
> to the defaults where they are intended to extend defaults (have
> configuration <includeDefaults/> ?)
>     -->
>
> So it is explicit :)
>
> > >
> > > Martijn
> >
> >
> >
>
>
> [3]
> http://svn.apache.org/repos/asf/maven/maven-2/tags/maven-2.2.0/maven-core/src/main/resources/META-INF/plexus/components.xml
> --
>
> Tony Chemit
> --------------------
> tél: +33 (0) 2 40 50 29 28
> email: che...@codelutin.com
> http://www.codelutin.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>
Thank you for your help! Much appreciated.

I am not planning to go into defining a copy of the life cycle or creating
my own lifecycle. I want to use my mojo everywhere I want, and I want it to
be able to run it in any life cycle that exists.

Martijn

Reply via email to