Maven 2.x Ant Tasks

artifact:dependencies does not respect in the generated classpath the order of the dependencies

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0.4
  • Fix Version/s: 2.0.8
  • Component/s: dependencies task
  • Labels:
    None
  • Environment:
    Windows 2005
    Ant 1.6.5
    JDK 1.4.2_10
  • Number of attachments :
    1

Description

For example, if I put the dependencies in this order, in the generated classpath (dependency.classpath) the order of the jars seems to be different :

<artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset" useScope="runtime">
<remoteRepository refid="remote.repository"/>
<dependency groupId="projects" artifactId="abc" version="1.0"/>
<dependency groupId="projects" artifactId="def" version="1.0"/>
<dependency groupId="projects" artifactId="ghi" version="1.0"/>
</artifact:dependencies>

the order in the generated classpath dependency.classpath is not the same as :

<path id="dependency.classpath">
<pathelement location="${jars.location}/abc-1.0.jar"/>
<pathelement location="${jars.location}/def-1.0.jar"/>
<pathelement location="${jars.location}/ghi-1.0"/>
</path>

And my projects have to use those jars in a specific order, otherwhise the build fails.

Issue Links

Activity

Hide
John Casey added a comment -

downgrading priority since this appears to only affect the ant tasks, and also adding this to the Ant Tasks component.

Show
John Casey added a comment - downgrading priority since this appears to only affect the ant tasks, and also adding this to the Ant Tasks component.
Hide
Marco Ponzi added a comment -

I attach a project that demonstrates how this bug is relevant not only for the ant plugin.
See how generated compilation classpath is different running twice the same project (it seems the classpath is build in a non determinstic way!). The tgz includes two logs generated by maven. These two lines are from the diff of the two log files:

< [DEBUG] (f) classpathElements = [/home/marco/proj/BancaIntesa/MavenChangeManagement/maven/testscripts/sinapsi-provamaven/target/classes, /home/marco/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar, /home/marco/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar, /home/marco/.m2/repository/log4j/log4j/1.2.8/log4j-1.2.8.jar]

> [DEBUG] (f) classpathElements = [/home/marco/proj/BancaIntesa/MavenChangeManagement/maven/testscripts/sinapsi-provamaven/target/classes, /home/marco/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar, /home/marco/.m2/repository/log4j/log4j/1.2.8/log4j-1.2.8.jar, /home/marco/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar]

I have run maven like this:
mvn -X compile

I am compiling the software of a customer that includes two jars which include different versions of a certain class. I cannot specify which of the two must appear first in the classpath and be used during the compilation. No ant plugin is involved.

Show
Marco Ponzi added a comment - I attach a project that demonstrates how this bug is relevant not only for the ant plugin. See how generated compilation classpath is different running twice the same project (it seems the classpath is build in a non determinstic way!). The tgz includes two logs generated by maven. These two lines are from the diff of the two log files: < [DEBUG] (f) classpathElements = [/home/marco/proj/BancaIntesa/MavenChangeManagement/maven/testscripts/sinapsi-provamaven/target/classes, /home/marco/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar, /home/marco/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar, /home/marco/.m2/repository/log4j/log4j/1.2.8/log4j-1.2.8.jar] — > [DEBUG] (f) classpathElements = [/home/marco/proj/BancaIntesa/MavenChangeManagement/maven/testscripts/sinapsi-provamaven/target/classes, /home/marco/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar, /home/marco/.m2/repository/log4j/log4j/1.2.8/log4j-1.2.8.jar, /home/marco/.m2/repository/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar] I have run maven like this: mvn -X compile I am compiling the software of a customer that includes two jars which include different versions of a certain class. I cannot specify which of the two must appear first in the classpath and be used during the compilation. No ant plugin is involved.

People

Vote (3)
Watch (5)

Dates

  • Created:
    Updated:
    Resolved: