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

Reply via email to