Ivy
  1. Ivy
  2. IVY-1036

latest.integration isn't resolved against a Maven snapshot repository (when uniqueVersion = true)

    Details

      Description

      When latest.integration is the requested revision the ibiblio resolver doesn't go through the snapshots. So in effect you'll always end up with the latest.release.

      Given the following ivysettings:

      ivysettings.xml
      <ivysettings>
         <settings defaultResolver="snapshots.jboss.org"/>
         <resolvers>
            <ibiblio name="snapshots.jboss.org" m2compatible="true" usepoms="true" root="http://snapshots.jboss.org/maven2"/>
         </resolvers>
      </ivysettings>
      

      Ivy won't go through the unique snapshot versions:

      	listing revisions from maven-metadata: http://snapshots.jboss.org/maven2/org/jboss/ejb3/jboss-ejb3-cache/maven-metadata.xml
      	found revs: [0.13.1-SNAPSHOT, 1.0.1-SNAPSHOT]
      HTTP response status: 404 url=http://snapshots.jboss.org/maven2/org/jboss/ejb3/jboss-ejb3-cache/0.13.1-SNAPSHOT/jboss-ejb3-cache-0.13.1-SNAPSHOT.pom
      CLIENT ERROR: Not Found url=http://snapshots.jboss.org/maven2/org/jboss/ejb3/jboss-ejb3-cache/0.13.1-SNAPSHOT/jboss-ejb3-cache-0.13.1-SNAPSHOT.pom
      HTTP response status: 404 url=http://snapshots.jboss.org/maven2/org/jboss/ejb3/jboss-ejb3-cache/1.0.1-SNAPSHOT/jboss-ejb3-cache-1.0.1-SNAPSHOT.pom
      CLIENT ERROR: Not Found url=http://snapshots.jboss.org/maven2/org/jboss/ejb3/jboss-ejb3-cache/1.0.1-SNAPSHOT/jboss-ejb3-cache-1.0.1-SNAPSHOT.pom
      

      With the maven-snapshot-resolver it will:

      ivysettings.xml
      <ivysettings>
         <typedef name="maven-snapshot-resolver" classname="org.jboss.ejb3.ivy.plugins.resolver.MavenSnapshotResolver"/>
         <settings defaultResolver="snapshots.jboss.org"/>
         <resolvers>
            <maven-snapshot-resolver name="snapshots.jboss.org" m2compatible="true" usepoms="true" root="http://snapshots.jboss.org/maven2"/>
         </resolvers>
      </ivysettings>
      
      	listing revisions from maven-metadata: http://snapshots.jboss.org/maven2/org/jboss/ejb3/jboss-ejb3-cache/maven-metadata.xml
      	found revs: [0.13.1-SNAPSHOT, 1.0.1-SNAPSHOT]
      	snapshots.jboss.org: found md file for org.jboss.ejb3#jboss-ejb3-cache;latest.integration
      		=> http://snapshots.jboss.org/maven2/org/jboss/ejb3/jboss-ejb3-cache//1.0.1-SNAPSHOT/jboss-ejb3-cache-1.0.1-20090303.040911-22.pom (1.0.1-20090303.040911-22)
      
      1. MavenSnapshotResolver.java
        23 kB
        Carlo de Wolf
      2. IVY-1036.patch.txt
        3 kB
        Matt Benson

        Activity

        Hide
        Maarten Coene added a comment -

        Matt,

        I've merged your patch (with a little modification) in the 2.3.x branch because I think Maven Compatibility is important for Ivy.

        Thanks!
        Maarten

        Show
        Maarten Coene added a comment - Matt, I've merged your patch (with a little modification) in the 2.3.x branch because I think Maven Compatibility is important for Ivy. Thanks! Maarten
        Hide
        Matt Benson added a comment -

        No response; patch seems to be working properly.

        Committed revision 1398943.
        

        Should be in Ivy v2.4.0 but that version hasn't yet been added to JIRA.

        Show
        Matt Benson added a comment - No response; patch seems to be working properly. Committed revision 1398943. Should be in Ivy v2.4.0 but that version hasn't yet been added to JIRA.
        Hide
        Matt Benson added a comment -

        proposed patch to IBiblioResolver with test; review appreciated

        Show
        Matt Benson added a comment - proposed patch to IBiblioResolver with test; review appreciated
        Hide
        Matt Benson added a comment -

        To illustrate the previous point, a testcase that shows latest.integration works with uniqueVersion false:

            public void testResolveMaven2Snapshot2AsLatestIntegration() throws Exception {
                // test case for IVY-1036
                // here we test maven SNAPSHOT versions handling, 
                // with m2 snapshotRepository/uniqueVersion set to true
                // but retrieving by latest.integration
                Ivy ivy = new Ivy();
                ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
                ResolveReport report = ivy.resolve(
                    ModuleRevisionId.newInstance("org.apache", "test-SNAPSHOT2", "latest.integration"),
                    getResolveOptions(new String[] { "*(public)" }), true);
                assertNotNull(report);
                assertFalse(report.hasError());
        
                // dependencies
                assertTrue(getIvyFileInCache(
                    ModuleRevisionId.newInstance("org.apache", "test-SNAPSHOT2", "2.0.2-SNAPSHOT"))
                        .exists());
                assertTrue(getArchiveFileInCache(ivy, "org.apache", "test-SNAPSHOT2", "2.0.2-SNAPSHOT",
                    "test-SNAPSHOT2", "jar", "jar").exists());
            }
        
        Show
        Matt Benson added a comment - To illustrate the previous point, a testcase that shows latest.integration works with uniqueVersion false : public void testResolveMaven2Snapshot2AsLatestIntegration() throws Exception { // test case for IVY-1036 // here we test maven SNAPSHOT versions handling, // with m2 snapshotRepository/uniqueVersion set to true // but retrieving by latest.integration Ivy ivy = new Ivy(); ivy.configure( new File( "test/repositories/m2/ivysettings.xml" )); ResolveReport report = ivy.resolve( ModuleRevisionId.newInstance( "org.apache" , "test-SNAPSHOT2" , "latest.integration" ), getResolveOptions( new String [] { "*( public )" }), true ); assertNotNull(report); assertFalse(report.hasError()); // dependencies assertTrue(getIvyFileInCache( ModuleRevisionId.newInstance( "org.apache" , "test-SNAPSHOT2" , "2.0.2-SNAPSHOT" )) .exists()); assertTrue(getArchiveFileInCache(ivy, "org.apache" , "test-SNAPSHOT2" , "2.0.2-SNAPSHOT" , "test-SNAPSHOT2" , "jar" , "jar" ).exists()); }
        Hide
        Matt Benson added a comment - - edited

        What happens is that the timestamp reading stuff is never triggered for latest.integration. Since Maven 3 only allows deploying snapshots with timestamps this is quite important for interoperability (i.e. the uniqueVersion false approach will not work for artifacts deployed thus).

        Show
        Matt Benson added a comment - - edited What happens is that the timestamp reading stuff is never triggered for latest.integration . Since Maven 3 only allows deploying snapshots with timestamps this is quite important for interoperability (i.e. the uniqueVersion false approach will not work for artifacts deployed thus).
        Hide
        Matt Benson added a comment - - edited

        I have a failing test for this, cloned from ResolveTest#testResolveMaven2Snapshot1() :

            public void testResolveMaven2Snapshot1AsLatestIntegration() throws Exception {
                // test case for IVY-1036
                // here we test maven SNAPSHOT versions handling, 
                // with m2 snapshotRepository/uniqueVersion set to true
                // but retrieving by latest.integration
                Ivy ivy = new Ivy();
                ivy.configure(new File("test/repositories/m2/ivysettings.xml"));
                ResolveReport report = ivy.resolve(
                    ModuleRevisionId.newInstance("org.apache", "test-SNAPSHOT1", "latest.integration"),
                    getResolveOptions(new String[] {"*(public)"}), true);
                assertNotNull(report);
                assertFalse(report.hasError());
        
                // dependencies
                assertTrue(getIvyFileInCache(
                    ModuleRevisionId.newInstance("org.apache", "test-SNAPSHOT1", "2.0.2-SNAPSHOT")).exists());
                assertTrue(getArchiveFileInCache(ivy, "org.apache", "test-SNAPSHOT1", "2.0.2-SNAPSHOT",
                    "test-SNAPSHOT1", "jar", "jar").exists());
            }
        

        What I am lacking is any idea how to go about addressing the issue.

        Show
        Matt Benson added a comment - - edited I have a failing test for this, cloned from ResolveTest#testResolveMaven2Snapshot1() : public void testResolveMaven2Snapshot1AsLatestIntegration() throws Exception { // test case for IVY-1036 // here we test maven SNAPSHOT versions handling, // with m2 snapshotRepository/uniqueVersion set to true // but retrieving by latest.integration Ivy ivy = new Ivy(); ivy.configure( new File( "test/repositories/m2/ivysettings.xml" )); ResolveReport report = ivy.resolve( ModuleRevisionId.newInstance( "org.apache" , "test-SNAPSHOT1" , "latest.integration" ), getResolveOptions( new String [] { "*( public )" }), true ); assertNotNull(report); assertFalse(report.hasError()); // dependencies assertTrue(getIvyFileInCache( ModuleRevisionId.newInstance( "org.apache" , "test-SNAPSHOT1" , "2.0.2-SNAPSHOT" )).exists()); assertTrue(getArchiveFileInCache(ivy, "org.apache" , "test-SNAPSHOT1" , "2.0.2-SNAPSHOT" , "test-SNAPSHOT1" , "jar" , "jar" ).exists()); } What I am lacking is any idea how to go about addressing the issue.
        Hide
        Carlo de Wolf added a comment -

        Complete source can be found at https://gist.github.com/wolfc/jboss-ejb3-ivy.

        Show
        Carlo de Wolf added a comment - Complete source can be found at https://gist.github.com/wolfc/jboss-ejb3-ivy .
        Hide
        Carlo de Wolf added a comment -

        I've added a proper description.

        Show
        Carlo de Wolf added a comment - I've added a proper description.
        Hide
        Maarten Coene added a comment -

        I don't fully understand how your MavenSnapshotResolver behaves differently than the IbiblioResolver.
        Could you give a concrete example where the ibiblio-resolver fails to handle latest.integration?

        Show
        Maarten Coene added a comment - I don't fully understand how your MavenSnapshotResolver behaves differently than the IbiblioResolver. Could you give a concrete example where the ibiblio-resolver fails to handle latest.integration?
        Hide
        Maarten Coene added a comment -

        I think we should update the existing ibiblio resolver to have this behaviour instead of creating a new one.

        Show
        Maarten Coene added a comment - I think we should update the existing ibiblio resolver to have this behaviour instead of creating a new one.
        Hide
        Carlo de Wolf added a comment -

        An alternate resolver based on the ibiblio resolver.

        Show
        Carlo de Wolf added a comment - An alternate resolver based on the ibiblio resolver.

          People

          • Assignee:
            Matt Benson
            Reporter:
            Carlo de Wolf
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development