Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven2 life cycle help

I’ve built a custom Maven2 plug-in using Ant. I would like to call another maven plug-in in particular the Cargo Maven2 plug-in immediately after the custom Ant plug-in successfully completes. However, I do not want to attach the Cargo plug-in to another goal or phase. Is there a way to have them run consecutively without having to write a batch script? Is there away to have the Custom Ant plug-in call out to the Cargo plug-in?

like image 324
Robert Nickens Avatar asked Nov 17 '25 21:11

Robert Nickens


1 Answers

See this discussion: Re: calling plugin in another plugin? According to the Maven developers, this is not the way plugins are supposed to work.

However, there is this interesting comment:

Plugins/Mojos should be thin wrappers around a library. You'd want to use the library directly.

Cargo is not only a Maven plugin, it also has a Java API and an Ant task. So you could probably:

  • call the Cargo Ant task from your Ant mojo (I think you'll just need the Cargo JARs in your plugin's classpath);

  • rewrite your Ant mojo in Java, and invoke the Cargo API (you'd want to look at the sources of the Cargo plugin).

like image 193
Olivier Avatar answered Nov 20 '25 21:11

Olivier