You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Martijn Morriën <dj...@gmail.com> on 2009/10/14 12:30:28 UTC
Is a Mojo default execution goal possible, leaving out the executions
goal part in the pom?
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
Re: Is a Mojo default execution goal possible, leaving out the
executions goal part in the pom?
Posted by Martijn Morriën <dj...@gmail.com>.
On Wed, Oct 14, 2009 at 13:52, Tony Chemit <ch...@codelutin.com> wrote:
> Le Wed, 14 Oct 2009 13:15:35 +0200,
> Tony Chemit <ch...@codelutin.com> a écrit :
>
> > Le Wed, 14 Oct 2009 13:02:20 +0200,
> > Martijn Morriën <dj...@gmail.com> a écrit :
> >
> > > On Wed, Oct 14, 2009 at 12:40, Tony Chemit <ch...@codelutin.com>
> wrote:
> > >
> > > > Le Wed, 14 Oct 2009 12:30:28 +0200,
> > > > Martijn Morriën <dj...@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: chemit@codelutin.com
> > > > http://www.codelutin.com
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@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: chemit@codelutin.com
> http://www.codelutin.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@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
Re: Is a Mojo default execution goal possible, leaving out the
executions goal part in the pom?
Posted by Tony Chemit <ch...@codelutin.com>.
Le Wed, 14 Oct 2009 13:15:35 +0200,
Tony Chemit <ch...@codelutin.com> a écrit :
> Le Wed, 14 Oct 2009 13:02:20 +0200,
> Martijn Morriën <dj...@gmail.com> a écrit :
>
> > On Wed, Oct 14, 2009 at 12:40, Tony Chemit <ch...@codelutin.com> wrote:
> >
> > > Le Wed, 14 Oct 2009 12:30:28 +0200,
> > > Martijn Morriën <dj...@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: chemit@codelutin.com
> > > http://www.codelutin.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@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: chemit@codelutin.com
http://www.codelutin.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Is a Mojo default execution goal possible, leaving out the
executions goal part in the pom?
Posted by Tony Chemit <ch...@codelutin.com>.
Le Wed, 14 Oct 2009 13:02:20 +0200,
Martijn Morriën <dj...@gmail.com> a écrit :
> On Wed, Oct 14, 2009 at 12:40, Tony Chemit <ch...@codelutin.com> wrote:
>
> > Le Wed, 14 Oct 2009 12:30:28 +0200,
> > Martijn Morriën <dj...@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: chemit@codelutin.com
> > http://www.codelutin.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@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 ?
>
> Martijn
--
Tony Chemit
--------------------
tél: +33 (0) 2 40 50 29 28
email: chemit@codelutin.com
http://www.codelutin.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Is a Mojo default execution goal possible, leaving out the
executions goal part in the pom?
Posted by Martijn Morriën <dj...@gmail.com>.
On Wed, Oct 14, 2009 at 12:40, Tony Chemit <ch...@codelutin.com> wrote:
> Le Wed, 14 Oct 2009 12:30:28 +0200,
> Martijn Morriën <dj...@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: chemit@codelutin.com
> http://www.codelutin.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@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> ?
Martijn
Re: Is a Mojo default execution goal possible, leaving out the
executions goal part in the pom?
Posted by Tony Chemit <ch...@codelutin.com>.
Le Wed, 14 Oct 2009 12:30:28 +0200,
Martijn Morriën <dj...@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: chemit@codelutin.com
http://www.codelutin.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org