How to build specific maven projects

In Maven on 04/03/2010 by pier0w Tagged: ,

The latests versions of maven allow you to select which projects you would like to build when running from the root projects.
So say we have the following project structure:

A / AA
A / AB
B / BA
B / BB
C / CA
C / CB

If we wished to run a “clean install” only over the projects ‘A’, ‘BB’, and ‘CA’ we can do this with the “-pl, –projects” option.
Though when this option is used it acts as a whitelist so if we wish to build the whole of ‘A’ including ‘AA’ and ‘AB’ then we will have to list them as well. Assuming this is the case then the command would be as follows:

mvn clean install --projects A,A/AA,A/AB,B/BB,C/CA

Now the names used in this option are the directory names of the projects NOT the artifactId’s within the pom files.


Comments Off on How to build specific maven projects

%d bloggers like this: