I see...but I still don't understand then, how I can bind my mojo to a specific phase in the lifecycle, without triggering a parallel lifecycle run (which is "@execute", right?). If I bind to the 'process-classes', and specifiy "@execute phase=compile" I wouldn't want to cause maven to initiate another run and recompile the project since it already did that.
My second objective is to spare the plugin users from specifying the <executions> element because it seems to me it's a decision my plugin should make - not the users. Thanks for your kind help... On 2/1/06, Mike Perham <[EMAIL PROTECTED]> wrote: > A mojo is a goal, yes. What's to stop you from having two mojos, each > with the same default phase? > > -----Original Message----- > From: Arik Kfir [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 31, 2006 6:02 PM > To: Maven Users List > Subject: Re: [m2] binding mojos to lifecycle > > Hi Mike, > > I'm not sure I follow - I specify the "@phase" inside my mojo (which is > basically a goal, right?) so as-far-as-I-understand maven should know > which goal to invoke... > > > On 2/1/06, Mike Perham <[EMAIL PROTECTED]> wrote: > > Look at it the other way. You've told maven that you are interested > > in having this plugin execute at some point during your lifecycle but > > you haven't defined which GOAL to execute. Remember a plugin can have > > > N goals. Maven should use the goal's default phase if you don't > > specify the <phase> element of the execution. > > > > > > -----Original Message----- > > From: Arik Kfir [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, January 31, 2006 5:39 PM > > To: Maven Users List > > Subject: [m2] binding mojos to lifecycle > > > > Hi, > > > > I have a small mojo which I want to bind to the 'process-classes' > > phase. I've read > > http://maven.apache.org/developers/mojo-api-specification.html which > > indicates I should add a "@phase process-classes" to the class > > comment, and I did: > > > > /** > > * > > * @goal generate > > * @phase process-classes > > * @author arik > > */ > > public class .... { > > ... > > } > > > > In the project that uses this plugin I declared: > > > > <build> > > <plugins> > > <plugin> > > <groupId>myGroupId</groupId> > > <artifactId>myPluginArtifactId</artifactId> > > <configuration> > > <!-- ... some configuration... --> > > </configuration> > > </plugin> > > </plugins> > > </build> > > > > But the mojo isn't activated. > > > > If, however, I add this to the invoking POM (inside the above <plugin> > > section): > > <executions> > > <execution> > > <phase>process-classes</phase> > > <goals> > > <goal>generate</goal> > > </goals> > > </execution> > > </executions> > > > > everything works. > > > > It looks like I'm missing something but I can't figure out what...I > > went through all of the guides in the M2 site, but couldn't find a > > reason for this. Isn't M2 supposed to bind my mojo automatically (due > > to the @phase tag)? > > > > > > -- > > Regards, > > _____________________________________ > > Arik Kfir [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > Regards, > _____________________________________ > Arik Kfir [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Regards, _____________________________________ Arik Kfir [EMAIL PROTECTED]
