Home > Build-Management, Continuous Integration, Software Engineering > How to execute several maven plugins within a single build phase and set the respective execution order

How to execute several maven plugins within a single build phase and set the respective execution order

You can use the build lifecycle or phases to control the order of the plugin execution. In some scenario, you have to bound few plugins to same phase, but still want to control the order of the plugin execution.

Plugins bound to the same build phase should be executed in the same order as they are listed in the POM. But under certain circumstances , the order is not executed in the expected order, see this MNG-2258 and MNG-3719. This bug is fixed in Maven 3.0.3. With Maven 3.0.3 and above plugins bound to same phase will be executed in the same order as they are listed in the pom.xml.

 

If you have to use an older Maven version you can spread the tasks to different phases. But I dont think there is much sence for this solution. You can also do one of the following to solve the problem:

  1. try your luck and see if Maven chosses the right order for you (you probably tried that already)
  2. use standalone plugin – run the goal outside the lifecycle. something like: mvn package org.codehaus.mojo:nsis-maven-plugin:1.0:compile.
  3. separate them into module: have a parent pom containing two sub modules, one – your war project and the other for the nsis project.
  4. use a custom lifecycle by changing the type, in your case you can use “exe”. this is done by using a custom plugin extension (guide to using extension)
  5. use the jetspeed-mvn-maven-plugin. I have never used it but it seems relevant to your needs.

 

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s