Duncan Krebs
Duncan Krebs

Reputation: 3502

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

Upvotes: 3

Views: 607

Answers (1)

Duncan Krebs
Duncan Krebs

Reputation: 3502

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

Upvotes: 1

Related Questions