ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1398943 - in /ant/ivy/core/trunk: src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java test/java/org/apache/ivy/core/resolve/ResolveTest.java
Date Tue, 16 Oct 2012 19:34:19 GMT
Author: mbenson
Date: Tue Oct 16 19:34:19 2012
New Revision: 1398943

URL: http://svn.apache.org/viewvc?rev=1398943&view=rev
Log:
[IVY-1036] latest.integration isn't resolved against a Maven snapshot repository (when uniqueVersion
= true)

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java?rev=1398943&r1=1398942&r2=1398943&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java Tue Oct
16 19:34:19 2012
@@ -396,8 +396,13 @@ public class IBiblioResolver extends URL
                 List rres = new ArrayList();
                 for (Iterator iter = revs.iterator(); iter.hasNext();) {
                     String rev = (String) iter.next();
+                    ModuleRevisionId historicalMrid = ModuleRevisionId.newInstance(mrid,
rev);
+                    String snapshotVersion = findSnapshotVersion(historicalMrid);
+                    if (snapshotVersion != null) {
+                        pattern = pattern.replaceFirst("\\-\\[revision\\]", "-" + snapshotVersion);
+                    }
                     String resolvedPattern = IvyPatternHelper.substitute(
-                        pattern, ModuleRevisionId.newInstance(mrid, rev), artifact);
+                        pattern, historicalMrid, artifact);
                     try {
                         Resource res = repository.getResource(resolvedPattern);
                         if ((res != null) && res.exists()) {

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=1398943&r1=1398942&r2=1398943&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Tue Oct 16 19:34:19
2012
@@ -4602,6 +4602,26 @@ public class ResolveTest extends TestCas
             "test-SNAPSHOT1", "jar", "jar").exists());
     }
 
+    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());
+    }
+
     public void testResolveMaven2Snapshot2() throws Exception {
         // test case for IVY-501
         // here we test maven SNAPSHOT versions handling, 



Mime
View raw message