Author: maartenc
Date: Sun Nov 11 14:06:07 2007
New Revision: 593971

URL: http://svn.apache.org/viewvc?rev=593971&view=rev
Log:
FIX: Resolution failure when no ivy.xml file present (IVY-630)

Added:
    incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-630.xml
    incubator/ivy/core/trunk/test/repositories/IVY-630/
    incubator/ivy/core/trunk/test/repositories/IVY-630/ivysettings.xml
    incubator/ivy/core/trunk/test/repositories/IVY-630/junit-4.1/
    incubator/ivy/core/trunk/test/repositories/IVY-630/junit-4.1/jars/
    
incubator/ivy/core/trunk/test/repositories/IVY-630/junit-4.1/jars/junit-4.1.jar
Modified:
    incubator/ivy/core/trunk/CHANGES.txt
    
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java

Modified: incubator/ivy/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?rev=593971&r1=593970&r2=593971&view=diff
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Sun Nov 11 14:06:07 2007
@@ -53,6 +53,7 @@
 
    version in SVN
 =====================================
+- FIX: Resolution failure when no ivy.xml file present (IVY-630)
 - FIX: ${parent.version} property is not recognized in maven2 pom (IVY-620)
 - FIX: Ivy doesn't work with Ant 1.6.2 (IVY-614)
 - FIX: EmptyStackException when upgrading from 1.4 to 2.0 (IVY-610)

Modified: 
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java?rev=593971&r1=593970&r2=593971&view=diff
==============================================================================
--- 
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
 (original)
+++ 
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/util/ResolverHelper.java
 Sun Nov 11 14:06:07 2007
@@ -139,7 +139,10 @@
                 String rres = 
IvyPatternHelper.substituteToken(partiallyResolvedPattern,
                     IvyPatternHelper.REVISION_KEY, revs[i]);
                 try {
-                    ret.add(new ResolvedResource(rep.getResource(rres), 
revs[i]));
+                    Resource res = rep.getResource(rres);
+                    if ((res != null) && res.exists()) {
+                        ret.add(new ResolvedResource(res, revs[i]));
+                    }
                 } catch (IOException e) {
                     Message.warn("impossible to get resource from name listed 
by repository: "
                             + rres + ": " + e.getMessage());

Modified: 
incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java?rev=593971&r1=593970&r2=593971&view=diff
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java 
(original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java 
Sun Nov 11 14:06:07 2007
@@ -24,6 +24,8 @@
 import org.apache.ivy.Ivy;
 import org.apache.ivy.TestHelper;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.util.DefaultMessageImpl;
+import org.apache.ivy.util.Message;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.Delete;
@@ -71,6 +73,20 @@
         assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("org1", 
"mod1.2", "2.0"))
                 .exists());
         assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", 
"jar", "jar").exists());
+    }
+    
+    public void testResolveWithoutIvyFile() throws Exception {
+        // IVY-630
+        resolve.getProject().setProperty("ivy.settings.file", 
"test/repositories/IVY-630/ivysettings.xml");
+        
+        resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-630.xml"));
+        resolve.setConf("default");
+        resolve.setHaltonfailure(false);
+        resolve.execute();
+        
+        assertTrue(getIvyFileInCache(ModuleRevisionId.newInstance("junit", 
"junit", "4.1"))
+            .exists());
+        assertTrue(getArchiveFileInCache("junit", "junit", "4.1", "junit", 
"jar", "jar").exists());
     }
 
     private File getArchiveFileInCache(String organisation, String module, 
String revision,

Added: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-630.xml
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-630.xml?rev=593971&view=auto
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-630.xml (added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-630.xml Sun Nov 
11 14:06:07 2007
@@ -0,0 +1,24 @@
+<!--
+   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="1.2">
+  <info organisation="apache" module="630"/>
+  <dependencies>
+    <dependency org="junit" name="junit" rev="latest.integration" 
conf="default" transitive="false" />
+  </dependencies>
+</ivy-module>

Added: incubator/ivy/core/trunk/test/repositories/IVY-630/ivysettings.xml
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/repositories/IVY-630/ivysettings.xml?rev=593971&view=auto
==============================================================================
--- incubator/ivy/core/trunk/test/repositories/IVY-630/ivysettings.xml (added)
+++ incubator/ivy/core/trunk/test/repositories/IVY-630/ivysettings.xml Sun Nov 
11 14:06:07 2007
@@ -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 defaultCache="${cache.dir}" defaultResolver="1" 
checkUpToDate="true" />
+       <resolvers>
+               <filesystem allownomd="true" name="1">
+                       <ivy 
pattern="${ivy.settings.dir}/[module]-[revision]/ivy.xml"/>
+                       <artifact 
pattern="${ivy.settings.dir}/[module]-[revision]/jars/[artifact]-[revision].[ext]"/>
+               </filesystem>
+       </resolvers>
+</ivysettings>

Added: 
incubator/ivy/core/trunk/test/repositories/IVY-630/junit-4.1/jars/junit-4.1.jar
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/repositories/IVY-630/junit-4.1/jars/junit-4.1.jar?rev=593971&view=auto
==============================================================================
--- 
incubator/ivy/core/trunk/test/repositories/IVY-630/junit-4.1/jars/junit-4.1.jar 
(added)
+++ 
incubator/ivy/core/trunk/test/repositories/IVY-630/junit-4.1/jars/junit-4.1.jar 
Sun Nov 11 14:06:07 2007
@@ -0,0 +1 @@
+ 


Reply via email to