[MNG-7392] External test dependency's transitive internal dependency not regarded for build ordering
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
**[Peter Palaga](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ppalaga)** opened **[MNG-7392](https://issues.apache.org/jira/browse/MNG-7392?redirect=false)** and commented
Not 100% sure this is a bug. In any case, it is an interesting corner case and I feel a need to write it down somewhere.
Lets have a source tree like the following
```
org.foo:parent
|- org.foo:a
`- org.foo:b
```
Where "a before b" is the order of the `` in `org.foo:parent`
Further, `org.foo:a` depends on `org.bar:external` in scope test. Note that `org.bar:external` is external, i.e. not a part of the current tree/reactor.
And finally, `org.bar:external` depends on `org.foo:b`.
I'd naively expect maven to be able to figure out that `org.foo:b` needs to get built before `org.foo:a`, because otherwise `org.foo:a` cannot be built due to a missing transitive dependency `org.foo:b`.
But in reality, Maven is not able to do that. It orders `org.foo:a` before `org.foo:b` in the reactor and the build fails.
Reordering the `` elements in `org.foo:parent` is a workaround for stock Maven, but apparently it does not work for mvnd which still attempts to build `org.foo:a` and `org.foo:b` in parallel. A workaround valid for both mvn and mnvd is to add the following "virtual" dependency to `org.foo:a`:
```xml
org.foo
b
${project.version}
pom
test
*
*
```
---
No further details from [MNG-7392](https://issues.apache.org/jira/browse/MNG-7392?redirect=false)
Contributor guide
Assessment
This issue has not been assessed yet.