Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Windows XP, Java 1.5.0_08-b03, Ant 1.6.5, Maven 2.0.4
Description
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.
Attachments
Issue Links
- is related to
-
MANTTASKS-1 dependencies ant task incorrectly handles transitive snapshot dependencies
- Closed