`mvn -am -pl` unexpectedly skips bom import dependencies
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
### Affected version
3.9.11
### Bug description
I build a multi-module project that includes a bom, and components that use that bom for convenience.
It seems that the bom dependency of type import does not count as a dependency as far as the `-am` option is concerned, and it gets skipped if used.
Example project:
`pom.xml`
```xml
4.0.0
org.jdbi.internal
test-maven-bom-parent
1-SNAPSHOT
pom
test-bom
test-consumer
```
`test-bom/pom.xml`
```xml
4.0.0
org.jdbi.internal
test-maven-bom-parent
1-SNAPSHOT
..
test-bom
pom
org.jdbi
jdbi3-core
3.50.0
```
`test-consumer/pom.xml`
```xml
4.0.0
org.jdbi.internal
test-maven-bom-parent
1-SNAPSHOT
..
test-consumer
org.jdbi.internal
test-bom
${project.version}
pom
import
org.jdbi
jdbi3-core
```
As a developer trying to avoid building unnecessary modules, I run:
```
% mvn -B -o clean install -am -pl test-consumer
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for test-maven-bom-parent 1-SNAPSHOT:
[INFO]
[INFO] test-maven-bom-parent .............................. SUCCESS [ 0.110 s]
[INFO] test-consumer ...................................... SUCCESS [ 0.613 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
```
To me this is unexpected - the `test-consumer` artifact clearly has a SNAPSHOT dependency on `test-bom` in the current reactor, and by skipping it, the local repository unexpectedly does not contain current development changes to the `test-bom` artifact. This results either in errors (can't determine `jdbi3-core` version since the `test-bom` can't be found) or subtle bugs (wrong version of `jdbi3-core` used)
```
[ERROR] Failed to execute goal on project test-user: Could not collect dependencies for project org.jdbi.internal:test-user:jar:1-SNAPSHOT
[ERROR] Failed to read artifact descriptor for org.jdbi.internal:test-consumer:jar:1-SNAPSHOT
[ERROR] Caused by: The following artifacts could not be resolved: org.jdbi.internal:test-bom:pom:1-SNAPSHOT (absent): Cannot access ... in offline mode and the artifact org.jdbi.internal:test-bom:pom:1-SNAPSHOT has not been downloaded from it before.
```
Thank you!
Contributor guide
Assessment
This issue has not been assessed yet.