Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
2.2.1
-
None
-
None
-
Windows XP
Description
Maven doesn't consider scopes correctly when applying the "nearest definition" rule on competing dependency definitions.
We experienced an issue where a transitive compile time dependency on antlr was clobbered to test scope since a test framework artifact (at test scope) had also declared a dependency on antlr.
<dependencies>
<dependency>
<!-- some dependency that transitively pulls in antlr 3 levels deep -->
<scope>compile</scope>
</dependency>
<dependency>
<!-- some test framework dependency that transitively pulls in antlr 2 levels deep -->
<scope>test</scope>
</dependency>
</dependencies>
Since the test framework pulls in antlr at a shallower depth, it takes priority, but also clobbers antlr's scope to 'test'. Thus, the first declared library will now fail to function correctly at runtime since the required antlr jar hasn't been packaged.
Since the module is unaware whether it needs antlr at all, it doesn't make sense for it to declare it directly as a dependency or even in a dependency management section.
If a module requires an artifact at compile time at any depth, the scope should default to 'compile', and not be replaced by 'test' by competing dependency definitions.
Attachments
Attachments
Issue Links
- is duplicated by
-
MPIR-193 Compile scoped dependencies replaced by test
- Closed