Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Only build child snapshot modules in a maven parent build


I have a very large set of maven projects that are checked out together from my source repo, and for a specific release I only update code in a few projects at a time by incrementing the pom.xml version to be the next SNAPSHOT version. Then I have a parent pom that lists all the child modules in its pom.xml file where I run my maven commands to compile, install, deploy etc. During testing I want to run a maven build from the parent pom folder that will only include child modules that have SNAPSHOT versions and skip the rest so I can speed up the build time and more rapidly deploy SNAPSHOT versions into the repo.

What I'm looking for is something like "mvn clean install -SnapshotsOnly" where the build would run and only have child modules with SNAPSHOT versions added to the reactor. Any help would be appreciated, I can't get around this by only checking out projects I want to modify because then the parent pom cannot resolve child modules. - Duncan

like image 768
Duncan Krebs Avatar asked Dec 01 '25 13:12

Duncan Krebs


1 Answers

With the help of a comment I found the answer to this is to use the maven profiles feature where you can create multiple profiles in the parent pom file and have each profile define the subset of modules you want to build. Then when running the maven command you specify what profile to use, see the link below. - Duncan

Using profiles to control which Maven modules are built

like image 136
Duncan Krebs Avatar answered Dec 04 '25 02:12

Duncan Krebs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!