Jorge Gomez created MANT-73:
-------------------------------

             Summary: Wrong repositories in generated get-deps task and speed 
improvement
                 Key: MANT-73
                 URL: https://jira.codehaus.org/browse/MANT-73
             Project: Maven 2.x Ant Plugin
          Issue Type: Bug
    Affects Versions: 2.3
         Environment: linux, jDK 1.6, maven 3.0.4
            Reporter: Jorge Gomez
            Priority: Blocker
         Attachments: avoidsnapshots_and_skipexisting.diff

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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to