maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason van Zyl <>
Subject Re: Graph of lifecycle and plugin executions
Date Tue, 17 Nov 2015 17:56:07 GMT

> On Nov 17, 2015, at 12:06 PM, Thomas Meyer <> wrote:
> Am 17.11.2015 5:22 nachm. schrieb Jason van Zyl <>:
>>> On Nov 17, 2015, at 11:02 AM, Thomas Meyer <> 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]:

> 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.



Jason van Zyl
Founder, Takari and Apache Maven

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:
For additional commands, e-mail:

View raw message