How to build a module and its submodules using maven reactor?
I have a project with three levels of modules. Let's suppose it has the following organization ... +-- maven-root +-- maven-module-1 | +-- maven-submodule-1-1 | +-- maven-submodule-1-2 +-- maven-module-2 | +-- maven-submodule-2-1 | +-- maven-submodule-2-2 +-- maven-module-3 +-- maven-submodule-3-1 +-- maven-submodule-3-2 Additionally, we have the following set of dependencies maven-module-2 depends upon maven-module-1 maven-module-3 depends upon maven-module-3 In this structure, and supposing artifacts for maven-module-1 and its submodules are already available in local repository, is there a solution using maven reactor (as an example) to build only maven-module-2 and its submodules ? I already know that, using maven reactor, if I do mvn clean install -pl :maven-module-2 --also-make-dependant It will build maven-module-2 maven-submodule-2-1 maven-submodule-2-2 maven-module-3 maven-submodule-3-1 maven-submodule-3-2 as maven-module-3 have a dependency upon maven-module-2 And obviously, running mvn clean install -pl :maven-module-2 --also-make-dependant will only build maven-module-1 and maven-module-2. So, how, using that project organization, can I build only maven-module-2 ?
Using mvn clean install -f maven-module-2 -N will build only maven-module-2 and mvn clean install -f maven-module-2 will build maven-module-2 and its children Take care that -f is used to say to Maven to use another POM (or module directory and it takes the pom.xml in it) than the one in the current directory. Thus unlike -pl where maven considers all modules in your project and then build only a subpart of them, -f only build what is referenced by this project/module/pom. To do mvn clean install -f maven-module-2 is exactly like cd maven-module-2; mvn clean install
Maven clean install unable to get artifact from maven central
locking snapshot versions when depending on multi-module project
Configure maven-war-plugin to include project classes in root of WAR
ShrinkWrap load libraries from POM for JavaArchive
Add log4j maven dependency to war without having it in compile time
Grails plugin installation
Building a previous version from svn
Bamboo: change the build root for maven plugin?
maven release plugin with phase and jar-with-dependencies
Failed to resolve dependency for wicket on jenkins and not on local machine
Java Build Tools: Ant vs. Maven [closed]
Maven build parameter to exclude a pom dependency
How to manage Tycho / EAP versionning correctly
Issue when injecting MavenProject into Maven test
Leiningen equivalent for maven dependency `type` element
Nexus Unable to connect with repos on the Internet