Author: maartenc
Date: Thu Oct 18 19:32:08 2012
New Revision: 1399811

URL: http://svn.apache.org/viewvc?rev=1399811&view=rev
Log:
Merged changes for IVY-1036 from trunk.

Modified:
    ant/ivy/core/branches/2.3.x/   (props changed)
    ant/ivy/core/branches/2.3.x/CHANGES.txt
    
ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
    
ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java

Propchange: ant/ivy/core/branches/2.3.x/
------------------------------------------------------------------------------
  Merged /ant/ivy/core/trunk:r1398531-1399805

Modified: ant/ivy/core/branches/2.3.x/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/CHANGES.txt?rev=1399811&r1=1399810&r2=1399811&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/CHANGES.txt (original)
+++ ant/ivy/core/branches/2.3.x/CHANGES.txt Thu Oct 18 19:32:08 2012
@@ -130,6 +130,7 @@ for detailed view of each issue, please 
        
    2.3.x
 =====================================
+- FIX: latest.integration isn't resolved against a Maven snapshot repository 
(when uniqueVersion = true) (IVY-1036)
 - FIX: Resolve does not deliver all dependent artifacts (IVY-1366) (thanks to 
Wolfgang Frank)
 - FIX: Ivy descriptors are merged incorrectly when there is an <exclude> 
element (IVY-1356)
 - FIX: SimpleDateFormat is not thread safe (IVY-1373)

Modified: 
ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java?rev=1399811&r1=1399810&r2=1399811&view=diff
==============================================================================
--- 
ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
 (original)
+++ 
ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
 Thu Oct 18 19:32:08 2012
@@ -399,8 +399,15 @@ 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);
+                    if (rev.endsWith("SNAPSHOT")) {
+                        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/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=1399811&r1=1399810&r2=1399811&view=diff
==============================================================================
--- 
ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java
 (original)
+++ 
ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java
 Thu Oct 18 19:32:08 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, 
@@ -4621,6 +4641,26 @@ public class ResolveTest extends TestCas
             "test-SNAPSHOT2", "jar", "jar").exists());
     }
 
+    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());
+    }
 
     public void testNamespaceMapping() throws Exception {
         // the dependency is in another namespace


Reply via email to