Reputation: 5428
I have the following source layout:
.
├── pom.xml
├── modules (has pom)
│ ├── module1 (has pom)
│ └── module2 (has pom)
│ └── moduleN (has pom)
└── webapp1 (has pom)
└── webapp2 (has pom)
webapp1 and webapp2 depends on all of the modules (the modules being DAO, services, etc).
At the moment, I build everything from the root and mvn package
gives me two WAR files.
How do I build only webapp1 or webapp2?
If I cd
into webapp1 and run mvn package
it says it can't download moduleX.jar (this is with a clean repository). Surely Maven should be able to deduce that those modules need to be built first as dependencies?
Upvotes: 1
Views: 962
Reputation: 570395
How do I build only webapp1 or webapp2?
Use "advanced reactor options". From the root:
mvn install -pl webapp1 -am
This tells maven to install webapp1
and the projects on which webapp1
depends (in the right order).
The help (mvn -h
) documents these commands like this:
-pl, --projects Build specified reactor projects instead of all projects -am, --also-make If project list is specified, also build projects required by the list
Note that you need to invoke I was wrong, calling install
, dependencies are always resolved through the local repository (so you need to install
them).package
does work (I don't know how/why, but it does).
Upvotes: 1