maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Bentmann (JIRA)" <j...@codehaus.org>
Subject [jira] Updated: (MNG-4675) Compile scoped dependencies replaced by test
Date Sun, 21 Nov 2010 16:27:06 GMT

     [ http://jira.codehaus.org/browse/MNG-4675?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Benjamin Bentmann updated MNG-4675:
-----------------------------------

    Attachment: MNG-4675.zip

An example project created from the few bits of information seems fine:
{noformat}
[INFO] [dependency:tree {execution: default-cli}]
[INFO] test:it:jar:0.1
[INFO] +- test:c:jar:0.1:compile
[INFO] |  \- test:b:jar:0.1:compile
[INFO] |     \- antlr:antlr:jar:2.7.7:compile
[INFO] \- test:t:jar:0.1:test
[INFO]    \- (antlr:antlr:jar:2.7.7:compile - scope updated from test; omitted for duplicate)
{noformat}
i.e. antlr retains the compile scope despite the shorter path via a test-scope dependency.

> 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
>             Fix For: Issues to be reviewed for 3.x
>
>         Attachments: MNG-4675.zip
>
>
> 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

        

Mime
View raw message