Search code examples
mavenmodulemaven-antrun-plugin

Execute maven task first thing


I have a multi-module maven project and would like to execute an ant task before maven starts building the reactor.

The only solution I've come up is to create a module that will execute this ant task, and have that module be the first in the list of <modules>, but I feel that is not the maven way (or is it?)

Is there a way to accomplish this?

Thanks

Edit:

The reason I need this is because I have environmental settings I need to configure for this project only when a complete build is required. The problem is, this ant task is quite expensive (10+ seconds), and so I don't want to run the task for individual module builds.


Solution

  • Your approach seems to be correct. I have seen similar build scripts in some client projects. The first module contains only one build plugin : maven-antrun-plugin. Rest of modules are normal Maven pom files that see the environment settings updated by Ant.