You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2010/06/09 23:14:52 UTC

svn commit: r953162 - in /ant/ivy/core/trunk: ./ doc/use/ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/core/deliver/ src/java/org/apache/ivy/core/resolve/ test/java/org/apache/ivy/core/resolve/ test/repositories/IVY-1159/ test/repositories/IVY-...

Author: maartenc
Date: Wed Jun  9 21:14:51 2010
New Revision: 953162

URL: http://svn.apache.org/viewvc?rev=953162&view=rev
Log:
FIX: Resolved Ivy properties written to cache during ivy:resolve incorrectly represents forced revisions (IVY-1159)

Added:
    ant/ivy/core/trunk/test/repositories/IVY-1159/
    ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modA_then_modB.xml   (with props)
    ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modB_then_modA.xml   (with props)
    ant/ivy/core/trunk/test/repositories/IVY-1159/ivysettings.xml   (with props)
    ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/
    ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/
    ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/1/
    ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/1/ivy.xml   (with props)
    ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/1/modA.jar   (with props)
    ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/
    ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/1/
    ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/1/ivy.xml   (with props)
    ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/1/modB.jar   (with props)
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/doc/use/deliver.html
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=953162&r1=953161&r2=953162&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Wed Jun  9 21:14:51 2010
@@ -126,6 +126,7 @@ for detailed view of each issue, please 
 - IMPROVEMENT: Trace a message when a property file referenced from the settings doesn't exixts (IVY-1074)
 - IMPROVEMENT: use defaultconf in combination with defaultconfmapping (IVY-1135) (thanks to Jon Schneider)
 
+- FIX: Resolved Ivy properties written to cache during ivy:resolve incorrectly represents forced revisions (IVY-1159)
 - FIX: Namespace rules not properly applied to parent projects (IVY-1186)
 - FIX: LatestVersionMatcher.needModuleDescriptor() does not honor custom statuses (IVY-1170) (thanks to Carl Quinn)
 - FIX: Proxy authentication could fail when using commons-httpclient 

Modified: ant/ivy/core/trunk/doc/use/deliver.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/use/deliver.html?rev=953162&r1=953161&r2=953162&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/use/deliver.html (original)
+++ ant/ivy/core/trunk/doc/use/deliver.html Wed Jun  9 21:14:51 2010
@@ -97,8 +97,10 @@ It can also be useful if you want to tri
         <td>No. No recursive delivery is done by default</td></tr>
     <tr><td>validate</td><td>true to force ivy files validation against ivy.xsd, false to force no validation</td>
         <td>No. Defaults to default ivy value (as configured in configuration file)</td></tr>
-    <tr><td>replacedynamicrev</td><td>true to replace dynmic revisions by static ones in the delivered file, false to avoid this replacement <span class="since">(since 1.3)</span></td>
+    <tr><td>replacedynamicrev</td><td>true to replace dynamic revisions by static ones in the delivered file, false to avoid this replacement <span class="since">(since 1.3)</span></td>
         <td>No. Defaults to true</td></tr>
+    <tr><td>replaceForcedRev</td><td>true to replace revisions (static or dynamic) by the revision of the resolver in <a href="../settings/resolvers.html#common">forced mode</a>, false to avoid this replacement <span class="since">(since 2.2)</span></td>
+        <td>No. Defaults to false</td></tr>
     <tr><td>merge</td><td>if a descriptor <a href="../ivyfile/extends.html">extends</a> a parent, merge the inherited information directly into the delivered descriptor.  The <i>extends</i> element itself will be commented out in the delivered descriptor. <span class="since">(since 2.2)</span></td>
         <td>No. Defaults to true.</td></tr>
 	<tr><td>settingsRef</td><td>A reference to the ivy settings that must be used by this task <span class="since">(since 2.0)</span></td>

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java?rev=953162&r1=953161&r2=953162&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java Wed Jun  9 21:14:51 2010
@@ -198,6 +198,8 @@ public class IvyDeliver extends IvyTask 
     private File deliveryList;
 
     private boolean replacedynamicrev = true;
+    
+    private boolean replaceForcedRev = false;
 
     private String resolveId;
 
@@ -292,6 +294,14 @@ public class IvyDeliver extends IvyTask 
     public void setReplacedynamicrev(boolean replacedynamicrev) {
         this.replacedynamicrev = replacedynamicrev;
     }
+    
+    public boolean isReplaceForcedRev() {
+        return replaceForcedRev;
+    }
+    
+    public void setReplaceForcedRev(boolean replaceForcedRev) {
+        this.replaceForcedRev = replaceForcedRev;
+    }
 
     public String getResolveId() {
         return resolveId;
@@ -403,6 +413,7 @@ public class IvyDeliver extends IvyTask 
             DeliverOptions options = new DeliverOptions(status, pubdate, 
                 drResolver, doValidate(settings), replacedynamicrev, splitConfs(conf))
                 .setResolveId(resolveId)
+                .setReplaceForcedRevisions(isReplaceForcedRev())
                 .setGenerateRevConstraint(generateRevConstraint)
                 .setMerge(merge)
                 .setPubBranch(pubBranch);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java?rev=953162&r1=953161&r2=953162&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java Wed Jun  9 21:14:51 2010
@@ -150,6 +150,17 @@ public class DeliverEngine {
                 resolvedRevisions.put(decodedMrid, parts[0]);
             }
             dependenciesStatus.put(decodedMrid, parts[1]);
+            
+            if (options.isReplaceForcedRevisions()) {
+                if (parts.length <= 2) {
+                    // maybe the properties file was generated by an older Ivy version
+                    // so it is possible that this part doesn't exist.
+                    throw new IllegalStateException("ivy properties file generated by an older" +
+                    		" version of Ivy which doesn't support replacing forced revisions!");
+                }
+            
+                resolvedRevisions.put(decodedMrid, parts[2]);
+            }
         }
 
         // 3) use pdrResolver to resolve dependencies info

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java?rev=953162&r1=953161&r2=953162&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java Wed Jun  9 21:14:51 2010
@@ -34,6 +34,7 @@ public class DeliverOptions {
     private boolean validate = true;
 
     private boolean resolveDynamicRevisions = true;
+    private boolean replaceForcedRevisions = false;
 
     private String resolveId;
 
@@ -122,6 +123,15 @@ public class DeliverOptions {
         this.resolveDynamicRevisions = resolveDynamicRevisions;
         return this;
     }
+    
+    public boolean isReplaceForcedRevisions() {
+        return replaceForcedRevisions;
+    }
+    
+    public DeliverOptions setReplaceForcedRevisions(boolean replaceForcedRevisions) {
+        this.replaceForcedRevisions = replaceForcedRevisions;
+        return this;
+    }
 
     public boolean isValidate() {
         return validate;

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?rev=953162&r1=953161&r2=953162&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java Wed Jun  9 21:14:51 2010
@@ -27,11 +27,13 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 
@@ -253,6 +255,14 @@ public class ResolveEngine {
                         md.getResolvedModuleRevisionId());
             Properties props = new Properties();
             if (dependencies.length > 0) {
+                Map forcedRevisions = new HashMap();
+                for (int i = 0; i < dependencies.length; i++) {
+                    if (dependencies[i].getModuleRevision() != null
+                            && dependencies[i].getModuleRevision().isForce()) {
+                        forcedRevisions.put(dependencies[i].getModuleId(), dependencies[i].getResolvedId());
+                    }
+                }
+
                 IvyNode root = dependencies[0].getRoot();
                 for (int i = 0; i < dependencies.length; i++) {
                     if (!dependencies[i].hasProblem()) {
@@ -261,6 +271,20 @@ public class ResolveEngine {
                             ModuleRevisionId depResolvedId = dependencies[i].getResolvedId();
                             ModuleDescriptor depDescriptor = dependencies[i].getDescriptor();
                             ModuleRevisionId depRevisionId = dd.getDependencyRevisionId();
+                            ModuleRevisionId forcedRevisionId = (ModuleRevisionId) 
+                                    forcedRevisions.get(dependencies[i].getModuleId());
+                            
+                            if (dependencies[i].getModuleRevision() != null
+                                    && dependencies[i].getModuleRevision().isForce()
+                                    && !depResolvedId.equals(depRevisionId)
+                                    && !settings.getVersionMatcher().isDynamic(depRevisionId)) {
+                                // if we were forced to this revision and we 
+                                // are not a dynamic revision, reset to the 
+                                // asked revision
+                                depResolvedId = depRevisionId;
+                                depDescriptor = null;
+                            }
+                            
                             if (depResolvedId == null) {
                                 throw new NullPointerException("getResolvedId() is null for " 
                                     + dependencies[i].toString());
@@ -270,10 +294,11 @@ public class ResolveEngine {
                                     + "is null for " + dd.toString());
                             }
                             String rev = depResolvedId.getRevision();
-                            // The evicted modules have no description, so we can't put their
-                            // status.
+                            String forcedRev = forcedRevisionId == null ? rev : forcedRevisionId.getRevision();
+                            
+                            // The evicted modules have no description, so we can't put the status
                             String status = depDescriptor == null ? "?" : depDescriptor.getStatus();
-                            props.put(depRevisionId.encodeToString(), rev + " " + status);
+                            props.put(depRevisionId.encodeToString(), rev + " " + status + " " + forcedRev);
                         }
                     }
                 }

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=953162&r1=953161&r2=953162&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 Wed Jun  9 21:14:51 2010
@@ -65,7 +65,6 @@ import org.apache.ivy.util.CacheCleaner;
 import org.apache.ivy.util.FileUtil;
 import org.apache.ivy.util.MockMessageLogger;
 import org.apache.ivy.util.StringUtils;
-import org.apache.tools.ant.util.FileUtils;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
@@ -75,8 +74,6 @@ import org.xml.sax.helpers.DefaultHandle
 public class ResolveTest extends TestCase {
     private Ivy ivy;
 
-    private IvySettings settings;
-
     private File cache;
     private File deliverDir;
 
@@ -93,7 +90,6 @@ public class ResolveTest extends TestCas
 
         ivy = Ivy.newInstance();
         ivy.configure(new File("test/repositories/ivysettings.xml"));
-        settings = ivy.getSettings();
     }
 
     private void createCache() {
@@ -105,9 +101,8 @@ public class ResolveTest extends TestCas
         FileUtil.forceDelete(deliverDir);
     }
 
-
     public void testResolveWithRetainingArtifactName() throws Exception {
-        ((DefaultRepositoryCacheManager) settings.getDefaultRepositoryCacheManager())
+        ((DefaultRepositoryCacheManager) ivy.getSettings().getDefaultRepositoryCacheManager())
                 .setArtifactPattern(ivy.substitute("[module]/[originalname].[ext]"));
         ResolveReport report = ivy.resolve(new File("test/repositories/2/mod15.2/ivy-1.1.xml")
                 .toURL(), getResolveOptions(new String[] {"default"}));
@@ -139,7 +134,7 @@ public class ResolveTest extends TestCas
     }
 
     public void testResolveWithRetainingArtifactNameAndExtraAttributes() throws Exception {
-        ((DefaultRepositoryCacheManager) settings.getDefaultRepositoryCacheManager())
+        ((DefaultRepositoryCacheManager) ivy.getSettings().getDefaultRepositoryCacheManager())
                 .setArtifactPattern(ivy.substitute("[module]/[originalname].[ext]"));
         ResolveReport report = ivy.resolve(new File("test/repositories/2/mod15.4/ivy-1.1.xml")
                 .toURL(), getResolveOptions(new String[] {"default"}).setValidate(false));
@@ -776,12 +771,12 @@ public class ResolveTest extends TestCas
         resolver.setName("dual");
         FileSystemResolver r = new FileSystemResolver();
         r.setName("1");
-        r.addIvyPattern(settings.getBaseDir().getPath() 
+        r.addIvyPattern(ivy.getSettings().getBaseDir().getPath() 
             + "/build/testCache2/ivy-[module]-[revision].xml");
         resolver.add(r);
         r = new FileSystemResolver();
         r.setName("2");
-        r.addArtifactPattern(settings.getBaseDir().getPath() 
+        r.addArtifactPattern(ivy.getSettings().getBaseDir().getPath() 
             + "/build/testCache2/[artifact]-[revision].[ext]");
         resolver.add(r);
         ivy.getSettings().addResolver(resolver);
@@ -3156,17 +3151,17 @@ public class ResolveTest extends TestCas
                 .toURL(), getResolveOptions(new String[] {"default"}));
         assertFalse(report.hasError());
 
-        settings.setCircularDependencyStrategy(IgnoreCircularDependencyStrategy.getInstance());
+        ivy.getSettings().setCircularDependencyStrategy(IgnoreCircularDependencyStrategy.getInstance());
         report = ivy.resolve(new File("test/repositories/2/mod6.3/ivy-1.0.xml").toURL(),
             getResolveOptions(new String[] {"default"}));
         assertFalse(report.hasError());
 
-        settings.setCircularDependencyStrategy(WarnCircularDependencyStrategy.getInstance());
+        ivy.getSettings().setCircularDependencyStrategy(WarnCircularDependencyStrategy.getInstance());
         report = ivy.resolve(new File("test/repositories/2/mod6.3/ivy-1.0.xml").toURL(),
             getResolveOptions(new String[] {"default"}));
         assertFalse(report.hasError());
 
-        settings.setCircularDependencyStrategy(ErrorCircularDependencyStrategy.getInstance());
+        ivy.getSettings().setCircularDependencyStrategy(ErrorCircularDependencyStrategy.getInstance());
         try {
             ivy.resolve(new File("test/repositories/2/mod6.3/ivy-1.0.xml").toURL(),
                 getResolveOptions(new String[] {"default"}));
@@ -3185,7 +3180,7 @@ public class ResolveTest extends TestCas
             getResolveOptions(new String[] {"*"}));
         assertFalse(report.hasError());
 
-        settings.setCircularDependencyStrategy(ErrorCircularDependencyStrategy.getInstance());
+        ivy.getSettings().setCircularDependencyStrategy(ErrorCircularDependencyStrategy.getInstance());
         try {
             ivy.resolve(new File("test/repositories/circular/ivy.xml").toURL(),
                 getResolveOptions(new String[] {"*"}));
@@ -3210,21 +3205,21 @@ public class ResolveTest extends TestCas
         assertEquals(1, report.getConfigurationReport("default").getArtifactsNumber());
         assertEquals(1, report.getConfigurationReport("test").getArtifactsNumber());
 
-        settings.setCircularDependencyStrategy(IgnoreCircularDependencyStrategy.getInstance());
+        ivy.getSettings().setCircularDependencyStrategy(IgnoreCircularDependencyStrategy.getInstance());
         report = ivy.resolve(new File("test/repositories/2/mod6.3/ivy-1.2.xml").toURL(),
             getResolveOptions(new String[] {"default", "test"}));
         assertFalse(report.hasError());
         assertEquals(1, report.getConfigurationReport("default").getArtifactsNumber());
         assertEquals(1, report.getConfigurationReport("test").getArtifactsNumber());
 
-        settings.setCircularDependencyStrategy(WarnCircularDependencyStrategy.getInstance());
+        ivy.getSettings().setCircularDependencyStrategy(WarnCircularDependencyStrategy.getInstance());
         report = ivy.resolve(new File("test/repositories/2/mod6.3/ivy-1.2.xml").toURL(),
             getResolveOptions(new String[] {"default", "test"}));
         assertFalse(report.hasError());
         assertEquals(1, report.getConfigurationReport("default").getArtifactsNumber());
         assertEquals(1, report.getConfigurationReport("test").getArtifactsNumber());
 
-        settings.setCircularDependencyStrategy(ErrorCircularDependencyStrategy.getInstance());
+        ivy.getSettings().setCircularDependencyStrategy(ErrorCircularDependencyStrategy.getInstance());
         try {
             ivy.resolve(new File("test/repositories/2/mod6.3/ivy-1.2.xml").toURL(),
                 getResolveOptions(new String[] {"default", "test"}));
@@ -3239,7 +3234,7 @@ public class ResolveTest extends TestCas
     public void testRegularCircular() throws Exception {
         // mod11.1 depends on mod11.2 but excludes itself
         // mod11.2 depends on mod11.1
-        settings.setCircularDependencyStrategy(ErrorCircularDependencyStrategy.getInstance());
+        ivy.getSettings().setCircularDependencyStrategy(ErrorCircularDependencyStrategy.getInstance());
         ResolveReport report = ivy.resolve(new File("test/repositories/2/mod11.1/ivy-1.0.xml")
                 .toURL(), getResolveOptions(new String[] {"test"}));
 
@@ -4614,7 +4609,7 @@ public class ResolveTest extends TestCas
         // mod12.2 depends on mod12.1 1.0 which depends on mod1.2
         // mod12.1 doesn't have revision in its ivy file
 
-        ((BasicResolver) settings.getResolver("2-ivy")).setCheckconsistency(false);
+        ((BasicResolver) ivy.getSettings().getResolver("2-ivy")).setCheckconsistency(false);
 
         ResolveReport report = ivy.resolve(new File("test/repositories/2/mod12.2/ivy-1.0.xml")
                 .toURL(), getResolveOptions(new String[] {"*"}));
@@ -5103,4 +5098,93 @@ public class ResolveTest extends TestCas
             // ignore
         }
     }
+    
+    public void testIVY1159_orderIsModAModB() throws Exception {
+        testIVY1159("ivy-depsorder_modA_then_modB.xml", false);
+
+        File deliveredIvyFile = new File("build/test/deliver/ivy-1.xml");
+        assertTrue(deliveredIvyFile.exists());
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+            ivy.getSettings(), deliveredIvyFile.toURL(), false);
+        DependencyDescriptor[] dds = md.getDependencies();
+        assertEquals(2, dds.length);
+        assertEquals(ModuleRevisionId.newInstance("myorg", "modA", "0"), dds[0].getDependencyRevisionId());
+        assertEquals(ModuleRevisionId.newInstance("myorg", "modB", "0"), dds[1].getDependencyRevisionId());
+    }
+
+    public void testIVY1159_orderIsModAModBReplaceForced() throws Exception {
+        testIVY1159("ivy-depsorder_modA_then_modB.xml", true);
+
+        File deliveredIvyFile = new File("build/test/deliver/ivy-1.xml");
+        assertTrue(deliveredIvyFile.exists());
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+            ivy.getSettings(), deliveredIvyFile.toURL(), false);
+        DependencyDescriptor[] dds = md.getDependencies();
+        assertEquals(2, dds.length);
+        assertEquals(ModuleRevisionId.newInstance("myorg", "modA", "1"), dds[0].getDependencyRevisionId());
+        assertEquals(ModuleRevisionId.newInstance("myorg", "modB", "1"), dds[1].getDependencyRevisionId());
+    }
+
+    public void testIVY1159_orderIsModBModA() throws Exception {
+        testIVY1159("ivy-depsorder_modB_then_modA.xml", false);
+
+        File deliveredIvyFile = new File("build/test/deliver/ivy-1.xml");
+        assertTrue(deliveredIvyFile.exists());
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+            ivy.getSettings(), deliveredIvyFile.toURL(), false);
+        DependencyDescriptor[] dds = md.getDependencies();
+        assertEquals(2, dds.length);
+        assertEquals(ModuleRevisionId.newInstance("myorg", "modB", "0"), dds[0].getDependencyRevisionId());
+        assertEquals(ModuleRevisionId.newInstance("myorg", "modA", "0"), dds[1].getDependencyRevisionId());
+    }
+
+    public void testIVY1159_orderIsModBModAReplaceForced() throws Exception {
+        testIVY1159("ivy-depsorder_modB_then_modA.xml", true);
+
+        File deliveredIvyFile = new File("build/test/deliver/ivy-1.xml");
+        assertTrue(deliveredIvyFile.exists());
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
+            ivy.getSettings(), deliveredIvyFile.toURL(), false);
+        DependencyDescriptor[] dds = md.getDependencies();
+        assertEquals(2, dds.length);
+        assertEquals(ModuleRevisionId.newInstance("myorg", "modB", "1"), dds[0].getDependencyRevisionId());
+        assertEquals(ModuleRevisionId.newInstance("myorg", "modA", "1"), dds[1].getDependencyRevisionId());
+    }
+
+    private void testIVY1159(String modCIvyFile, boolean replaceForced) throws Exception {
+        ivy = Ivy.newInstance();
+        ivy.configure(new File("test/repositories/IVY-1159/ivysettings.xml"));
+
+        ResolveOptions opts = new ResolveOptions();
+        opts.setConfs(new String[] {"*"});
+        opts.setResolveId("resolveid");
+        opts.setRefresh(true);
+        opts.setTransitive(true);
+
+        ResolveReport report = ivy.resolve(
+            new File("test/repositories/IVY-1159/"+modCIvyFile).toURL(),
+            opts
+        );
+        assertFalse(report.hasError());
+
+        assertEquals(
+            new HashSet(Arrays.asList(new ModuleRevisionId[] {
+                    ModuleRevisionId.newInstance("myorg", "modA", "1"),
+                    ModuleRevisionId.newInstance("myorg", "modB", "1")
+                                      })), 
+            report.getConfigurationReport("default").getModuleRevisionIds());
+        
+        DeliverOptions dopts = new DeliverOptions();
+        dopts.setReplaceForcedRevisions(replaceForced);
+        dopts.setGenerateRevConstraint(true);
+        dopts.setConfs(new String[] { "*" });
+        dopts.setStatus("release");
+        dopts.setPubdate(new Date());
+        dopts.setResolveId("resolveid");
+        String pubrev = "1";
+        String deliveryPattern = "build/test/deliver/ivy-[revision].xml";
+        
+        ivy.deliver(pubrev, deliveryPattern, dopts);
+    }
+
 }

Added: ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modA_then_modB.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modA_then_modB.xml?rev=953162&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modA_then_modB.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modA_then_modB.xml Wed Jun  9 21:14:51 2010
@@ -0,0 +1,31 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="2.0">
+  <info organisation="myorg" module="modC" revision="1"/>
+  <configurations>
+    <conf name="default"/>
+  </configurations>
+  <publications>
+    <artifact name="modC" ext="jar" type="lib"/>
+  </publications>
+  <dependencies>
+    <dependency name="modA" rev="0" conf="default->default"/>
+    <dependency name="modB" rev="0" conf="default->default"/>
+  </dependencies>
+</ivy-module> 

Propchange: ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modA_then_modB.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modB_then_modA.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modB_then_modA.xml?rev=953162&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modB_then_modA.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modB_then_modA.xml Wed Jun  9 21:14:51 2010
@@ -0,0 +1,31 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="2.0">
+  <info organisation="myorg" module="modC" revision="1"/>
+  <configurations>
+    <conf name="default"/>
+  </configurations>
+  <publications>
+    <artifact name="modC" ext="jar" type="lib"/>
+  </publications>
+  <dependencies>
+    <dependency name="modB" rev="0" conf="default->default"/>
+    <dependency name="modA" rev="0" conf="default->default"/>
+  </dependencies>
+</ivy-module> 

Propchange: ant/ivy/core/trunk/test/repositories/IVY-1159/ivy-depsorder_modB_then_modA.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/repositories/IVY-1159/ivysettings.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1159/ivysettings.xml?rev=953162&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1159/ivysettings.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1159/ivysettings.xml Wed Jun  9 21:14:51 2010
@@ -0,0 +1,27 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<ivysettings>
+   <settings defaultResolver="local" />
+   <resolvers>
+        <filesystem name="local" checkmodified="true" local="true" force="true">
+            <ivy pattern="${ivy.settings.dir}/[organisation]/[module]/[revision]/ivy.xml"/>
+            <artifact pattern="${ivy.settings.dir}/[organisation]/[module]/[revision]/[artifact].[ext]"/>
+        </filesystem>
+    </resolvers>
+</ivysettings>

Propchange: ant/ivy/core/trunk/test/repositories/IVY-1159/ivysettings.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/1/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/1/ivy.xml?rev=953162&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/1/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/1/ivy.xml Wed Jun  9 21:14:51 2010
@@ -0,0 +1,27 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="2.0">
+    <info organisation="myorg" module="modA" revision="1" />
+    <configurations>
+      <conf name="default"/>
+    </configurations>
+    <publications>
+      <artifact name="modA" ext="jar" type="lib" conf="default"/>
+    </publications>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/1/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/1/modA.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/1/modA.jar?rev=953162&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modA/1/modA.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/1/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/1/ivy.xml?rev=953162&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/1/ivy.xml (added)
+++ ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/1/ivy.xml Wed Jun  9 21:14:51 2010
@@ -0,0 +1,30 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="2.0">
+    <info organisation="myorg" module="modB" revision="1" />
+    <configurations>
+      <conf name="default"/>
+    </configurations>
+    <publications>
+      <artifact name="modB" ext="jar" type="lib" conf="default"/>
+    </publications>
+    <dependencies>
+      <dependency org="myorg" name="modA" rev="1" conf="default->default"/>
+    </dependencies>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/1/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/1/modB.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/1/modB.jar?rev=953162&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ant/ivy/core/trunk/test/repositories/IVY-1159/myorg/modB/1/modB.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream