This project was created to have a look into how the -pl option works.
aggregation
├── README.md
├── moduleA
│ ├── pom.xml
│ └── src
│ ├── main/java/dummy
│ │ └── AppA.java
│ └── test/java/dummy
│ └── AppATest.java
├── moduleB
│ ├── pom.xml
│ └── src
│ ├── main/java/dummy
│ │ └── AppB.java
│ └── test/java/dummy
│ └── AppBTest.java
├── moduleC
│ ├── pom.xml
│ └── src
│ ├── main/java/dummy
│ │ └── AppC.java
│ └── test/java/dummy
│ └── AppCTest.java
└── pom.xml
- All modules
A
,B
,C
are sub-modules of the rootaggregation
module - Modules
A
andB
defineaggregation
module as their parent - Module
B
definesC
as its depedendency
Builds are all invoked from the aggregation dir
Command: mvn clean package
Result: Modules built: aggregation, A, C, B
Command: mvn clean package -pl .
Result: Modules built: aggregation
Command: mvn clean package -pl . -am
Result: Modules built: aggregation
Command: mvn clean package -pl . -am -amd
Result:
- Modules identified to be built: aggregation, A, B
- Build fails:
Failed to execute goal on project moduleB: Could not resolve dependencies for project dummy:moduleB:jar:1.0-SNAPSHOT: Could not find artifact dummy:moduleC:jar:1.0-SNAPSHOT
- Seems that child projects are identified as dependants (thus -amd picks them up).
- Seems that sub-modules are not identified as dependencies in the aggregate module (thus -am doesn't pick them up)