I have a multi module maven project, which builds successfully, I\'d like to build just one of the modules I have. How would I do that with profiles ? I could d
To implement this with profiles, you could use two profiles, one with all modules and another one with the wanted module only. Something like this:
all
true
module-1
...
module-n
module-2
module-2
And then call it like this:
mvn -Pmodule-2 package
Two things to note here:
from the POM in a "default" profile (because from a profile are only additive, they do not hide the modules declared in the POM)., the "default" profile will be picked if nothing else is active but deactivated if something else is.One could even parametrize the name of the module and pass it as property:
...
module-x
module-name
${module-name}
And invoke maven like this:
mvn -Dmodule-name=module-2 package
But this is a poor implementation IMHO, I prefer the -pl "advanced" reactor options (less xml, much more power and flexibility):
mvn -pl module-2 package