I have a maven build and when the database changes we need to rebuild a specific project because it auto-generate some files, so I need some kind of conditional execution. I heard people talking about profiles, but in my case we are in the same profile (development) and just sometimes we need to build a specific module.
I wish for something like maven clean install -Dspecific.build
and some configuration in the pom to build this additional module. Is there something like that in maven?
Asked
Active
Viewed 379 times
0

islon
- 1,166
- 2
- 11
- 24
-
1You can use multiple profiles together and each can have different activation conditions. – billc.cn Sep 10 '12 at 19:21
-
And how do I execute multiple profiles together? – islon Sep 10 '12 at 19:31
-
1mvn -Pprofile1,profile2,profile3..... – Peter Svensson Sep 10 '12 at 19:47
-
Thanks, that's a really nice solution. Anyway my build order got messed up when I do that. Instead of building modules X, Y, Z, W (where Y is the build to be executed conditionally) I got X, Z, W, Y no matter the order I pass to -P (-Pdev,special or -Pspecial,dev) and my build fails. – islon Sep 10 '12 at 19:51
-
Build order is based on dependency resolution, so you should examine how your modules depend on each other. – noahlz Sep 10 '12 at 19:58
-
Ok, I got it. It wasn't dependency resolution it was the profile order in the pom: 'special' should come first. billc.cn, if you put your comment as an answer I'll accept it. – islon Sep 10 '12 at 20:03
-
1If I understand your question correctly, you can use Maven's new Advanced Reactor Options, see answer [here](http://stackoverflow.com/questions/11620566/how-to-activate-a-maven-profile-for-a-specific-module-in-a-mutli-module-project/11624416#11624416) for more details. – yorkw Sep 10 '12 at 21:46