> On Nov 17, 2015, at 12:06 PM, Thomas Meyer <[email protected]> wrote: > > Am 17.11.2015 5:22 nachm. schrieb Jason van Zyl <[email protected]>: >> >> >>> On Nov 17, 2015, at 11:02 AM, Thomas Meyer <[email protected]> wrote: >>> >>> Hi, >>> >>> okay thanks. >>> >>> Another question: >>> >>> What does it mean when a mojo execution is forked? >>> >> >> It corresponds to the execute annotation[1] where if you execute a goal and >> need to make sure the prerequisite lifecycle has run prior to said goal then >> Maven will “fork” a lifecycle to make sure this requirement is met. Before >> the goal is executed the lifecycle is run up to the phase you specify your >> goal needs. So your Mojo might have something like: >> >> @Execute(phase=“LifecyclePhase.COMPILE”) >> >> As your mojo needs to operate on compiled classes this will make sure the >> compiled classes are there. >> >> [1]: >> https://github.com/apache/maven-plugin-tools/blob/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Execute.java >> > > Hi, > > many thanks for the hint! I understand it now. So basically every mojo > callable from command line somehow need to set this annotation and all mojos > only usable in the pom doesn’t! >
Not necessarily. A mojo is not required to fork, only if it has prerequisites from the lifecycle. Many mojos invoked from the CLI are fully independent and don’t specify a phase or fork phase at all. I personally don’t recommend this type of setup, it’s either part of the lifecycle so run it from the lifecycle or it’s not. Thanks, Jason ---------------------------------------------------------- Jason van Zyl Founder, Takari and Apache Maven http://twitter.com/jvanzyl http://twitter.com/takari_io --------------------------------------------------------- A master in the art of living draws no sharp distinction between his work and his play; his labor and his leisure; his mind and his body; his education and his recreation. He hardly knows which is which. He simply pursues his vision of excellence through whatever he is doing, and leaves others to determine whether he is working or playing. To himself, he always appears to be doing both. -- François-René de Chateaubriand --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
