Reputation: 231
So my project has 3 modules but no parent pom file. I can run them manually one by one but I am looking for a way to run all of those 3 pom files using a single mvn command but no luck. So far I have tried few different combination but non of the worked for ex -
mvn -f module1/pom.xml -f module2/pom.xml -f module3/pom.xml clean install
but it runs only first pom file not all 3 of them. Tried using 'call' too but didn't work. Any thoughts?
Upvotes: 0
Views: 1772
Reputation: 4837
You can pipe the command of each project to execute one after the other:
mvn -f module1/pom.xml clean install | mvn -f module2/pom.xml clean install | mvn -f module3/pom.xml clean install
Upvotes: 0
Reputation: 35843
No.
If you always want to build those projects together, put them into a multi-module project and build it from the main POM of that project.
Upvotes: 3
Reputation: 669
Is there a specific reason to try and run them in one command? If it comes down that they depend on each other, you could find the pom
that needs to run first and add something like this
Your first pom
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<packaging>pom</packaging>
<modules>
<module>SecondPomFile</module> <---------------
<module>ThirdPomFile</module> <---------------
</modules>
</project>
The second pom
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>SecondPomFile</artifactId> <---------------
<version>1</version>
</project>
The Thirdpom
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>ThirdPomFile</artifactId> <---------------
<version>1</version>
</project>
and then run it like mvn -f pom.xml
Because you added
<modules>
<module>SecondPomFile</module> <---------------
<module>ThirdPomFile</module> <---------------
</modules>
The name you specified then points to the other poms and they run when the first one runs
Upvotes: -1