dependencies ant task does not handle scoped transitive dependencies correctly
------------------------------------------------------------------------------

                 Key: MNG-2543
                 URL: http://jira.codehaus.org/browse/MNG-2543
             Project: Maven 2
          Issue Type: Bug
          Components: Ant tasks
    Affects Versions: 2.0.4
         Environment: Windows XP, Java 1.5.0_08-b03, Ant 1.6.5, Maven 2.0.4
            Reporter: Rick Riemer


The ant <dependencies> task resolves transitive dependencies incorrectly if 
they're included in different scopes. Here's an example:

[dependencies section of pom.xml for project A]
...
<dependencies>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.13</version>
    </dependency>
</dependencies>
...

[dependencies section of pom.xml for project B]
...
<dependencies>
    <dependency>
        <groupId>my-company</groupId>
        <artifactId>project-A</artifactId>
        <version>1.0-SNAPSHOT</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.13</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.1</version>
    </dependency>
</dependencies>
...

[dependencies section of pom.xml for project C]
...
<dependencies>
    <dependency>
        <groupId>my-company</groupId>
        <artifactId>project-B</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
</dependencies>
...

When I use the <dependencies> task to build a "compile"-scope classpath for 
project B everything is OK:
<mvn:dependencies pathId="compile.classpath" useScope="compile">
    <pom refid="maven.pom" />
</mvn:dependencies>
-- gives --
\.m2\repository\commons-lang\commons-lang\2.1\commons-lang-2.1.jar
\.m2\repository\log4j\log4j\1.2.13\log4j-1.2.13.jar

But when I use the same task to build a "compile"-scope classpath for project 
C, log4j goes missing:
<mvn:dependencies pathId="compile.classpath" useScope="compile">
    <pom refid="maven.pom" />
</mvn:dependencies>
-- gives --
\.m2\repository\nl\forcare\common\1.0-SNAPSHOT\common-1.0-SNAPSHOT.jar
\.m2\repository\commons-lang\commons-lang\2.1\commons-lang-2.1.jar

I think that that log4j is filtered, because project A is only included in test 
scope, regardless of log4j also being present in project B. If I use the mvn 
executable itself to run a compile instead of the ant tasks, then there is no 
problem and log4j appears on the compile classpath. It seems that the ant tasks 
have a different mechanism of resolving dependencies than the mvn executable.


-- 
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