Maven reactor with project aggregation and work dir problem

40 views Asked by At

I am working on a generator project, which is split up in multiple maven sub-projects:

root
|pom.xml
|target/
|
+module1
|  |pom.xml
|  |target/
|  
+module2
   |pom.xml

The root pom is of packaging type "pom".

Module1 will now use

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.6.0</version>

to do a exec:java on a dependency jar that will generate some code to the relative path "target/generated-sources/..."

My problem is now that when doing a mvn clean install from within module1 everything works fine and the result is in "root/module1/target".

But when starting from the root directory with mvn clean install - then the code will be generated to root/target and will not be compiled/packaged by the module1 pom.xml - the result here is an empty jar.

So I assume that the work directory is different when starting from within the module or from the root.

How can I achieve that both kinds of start (from root or module1) will work with the same result? - i.e. how to achieve that the work directory is always there where the actual executing pom.mxl is?

0

There are 0 answers