[prev in list] [next in list] [prev in thread] [next in thread] 

List:       maven-user
Subject:    Re: Is a Mojo default execution goal possible, leaving out the
From:       Tony Chemit <chemit () codelutin ! com>
Date:       2009-10-14 10:40:43
Message-ID: 20091014124043.078d569f () codelutin ! com
[Download RAW message or body]

Le Wed, 14 Oct 2009 12:30:28 +0200,
Martijn Morriën <dj.escay@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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic