Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Auto Closed
-
2.3
-
None
-
None
-
linux, jDK 1.6, maven 3.0.4
-
Patch
Description
When one artifact existed in more than one repository, the first was selected by default. This lead to undesirable behaviors when developing for sonatype repository. In this case, I observed snapshots version were automatically selected, but they did not exist. For instance, the following was generated for Junit 4.8.1.
<get src="https://oss.sonatype.org/content/repositories/snapshots/junit/junit/4.8.1/junit-4.8.1.jar"
dest="${maven.repo.local}/junit/junit/4.8.1/junit-4.8.1.jar"
usetimestamp="false"
ignoreerrors="true"/>
https://oss.sonatype.org/content/repositories/snapshots/junit/junit/4.8.1/junit-4.8.1.jar does not exist, by the way. This lead to important delays in compilation and any other target depending on get-deps.
Making the AntBuildWriter select those repositories which are not snapshots, solves the issues. With the attched patch, the previous task becomes into:
<get src="https://oss.sonatype.org/content/repositories/snapshots/junit/junit/4.8.1/junit-4.8.1.jar"
dest="${maven.repo.local}/junit/junit/4.8.1/junit-4.8.1.jar"
usetimestamp="false"
ignoreerrors="true"/>
Nevertheless, this still makes the get-deps slow. By increasing the minimum ant version to 1.8.0, it is possible to use "skipexisting" attribute for ant task. This, combined with "usetimestamp=true" makes compilation lightning fast once everything is downloaded. Now the task looks like:
<get src="http://repo.maven.apache.org/maven2/junit/junit/4.8.1/junit-4.8.1.jar"
dest="${maven.repo.local}/junit/junit/4.8.1/junit-4.8.1.jar"
usetimestamp="true"
ignoreerrors="true"
skipexisting="true"/>
The attached patch was created against the 2.3 tag version of the repository, though it is present as well in the head of the trunk. The pom.xml file was modified only to include the 1.8.0 version of ant instead of the old 1.7.