How to build child modules independently from parent in Maven?

How do you force maven to execute antrun:run task after all the package tasks in a POM with child modules?

  • I have a parent POM with a bunch of child modules. I want to run an antrun:run task after all the children have executed a package task (I'm using Ant to package my app since i gave up figuring out how to get assembly to work correctly). I need to have the antrun task execute *after* all the children - but I can't associate it with package phase since parent gets "packaged" before children, and i need ant to run afterwards. Is there a way to do it in one command? Easy workaround, of course, is to run 2 maven commands, but i want to do it in one, if possible.

  • Answer:

    People on StackOverflow ended up being faster and brighter: http://stackoverflow.com/questions/3375574/how-do-you-force-maven-to-execute-antrunrun-task-after-all-the-package-tasks-in The key is to have another subproject that does all the relevant antrun:run packaging, and have that be at the end of your modules. While not the most maveny way, it certainly works quite well. yay!

Toli Kuznets at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.