Compile scoped dependencies replaced by test
--------------------------------------------

                 Key: MNG-4675
                 URL: http://jira.codehaus.org/browse/MNG-4675
             Project: Maven 2 & 3
          Issue Type: Bug
          Components: Dependencies
    Affects Versions: 2.2.1
         Environment: Windows XP
            Reporter: Siam Rafiee


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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to