On 6 Jun 07, at 6:52 AM 6 Jun 07, Jo Vandermeeren wrote:

Hi Zhangxu,

On 6/6/07, 張旭 <[EMAIL PROTECTED]> wrote:

Does maven2 has api to add and call a plugin in another plugin ?



This question has been asked a couple of times in the past, but nobody seems
to have an answer.

It's a bad practice, and leads to coupling between plugins which is bad. We've seen the aftermath of this happening in Maven 1.x.

What we promote is augmenting the lifecycle, or the creation of new lifecycles to slot in the functionality required.

In 2.0.x it is possible for Mojos in the same plugin to communicate with one another and in 2.1.x we have a data bus of sorts where information can be placed on the bus and examined by other plugins where this information can be keyed off of to do work generally.

If you have a set of plugins that work together then make a lifecycle given you can control the execution and ordering of the lifecycle instead of directly invoking Mojos from one another which is categorically a bad practice. It will lead to coupling and make your Mojo un-reusable for other use cases i.e. slotting them into other lifecycles.

So, I think it's fair to conclude that there is no API available for this.

Or should I spell out dependency on the plugin being called and invoke
Mojo.execute() directly?



You could indeed add the resp. plugin as a dependency and call it directly,
but how about configuring the plugin's input parameters?
That's a real pain.

An API would be very nice, including some form of Configuration object to
pass to the plugin.

Cheers
Jo

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder and PMC Chair, Apache Maven
jason at sonatype dot com
----------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to