diff --git a/CHANGES.txt b/CHANGES.txt
index 9082f2d5..b331603a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,7 @@
- IMPROVE: add possibility to choose matcher on include exclude and conflict manager rules (IVY-161)
- IMPROVE: add regexp management in the install ant task (IVY-154)
+- FIX: resolve fails without appropriate message when cache is empty and a module in the repository has no revision (IVY-165)
- FIX: resolve problem with configuration inheritance (IVY-164)
- FIX: some files in cache detected by not used by Ivy for subsequent retrieves (IVY-159)
- FIX: HTML report shouldn't display the dependencies of evicted modules (IVY-158) (thanks to Maarten Coene)
diff --git a/src/java/fr/jayasoft/ivy/resolver/BasicResolver.java b/src/java/fr/jayasoft/ivy/resolver/BasicResolver.java
index 4f86e3c0..78aeb81d 100644
--- a/src/java/fr/jayasoft/ivy/resolver/BasicResolver.java
+++ b/src/java/fr/jayasoft/ivy/resolver/BasicResolver.java
@@ -255,12 +255,8 @@ public abstract class BasicResolver extends AbstractResolver {
// check descriptor data is in sync with resource revision and names
systemMd = toSystem(md);
- if (!checkDescriptorConsistency(mrid, md, ivyRef)) {
- return null;
- }
- if (!checkDescriptorConsistency(systemDd.getDependencyRevisionId(), systemMd, ivyRef)) {
- return null;
- }
+ checkDescriptorConsistency(mrid, md, ivyRef);
+ checkDescriptorConsistency(systemDd.getDependencyRevisionId(), systemMd, ivyRef);
// check if we should delete old artifacts
boolean deleteOldArtifacts = false;
@@ -368,7 +364,7 @@ public abstract class BasicResolver extends AbstractResolver {
return node != null && node.getModuleRevision() != null;
}
- private boolean checkDescriptorConsistency(ModuleRevisionId mrid, ModuleDescriptor md, ResolvedResource ivyRef) {
+ private void checkDescriptorConsistency(ModuleRevisionId mrid, ModuleDescriptor md, ResolvedResource ivyRef) throws ParseException {
boolean ok = true;
if (!mrid.getOrganisation().equals(md.getModuleRevisionId().getOrganisation())) {
Message.error("\t"+getName()+": bad organisation found in "+ivyRef.getResource()+": expected="+mrid.getOrganisation()+" found="+md.getModuleRevisionId().getOrganisation());
@@ -378,15 +374,14 @@ public abstract class BasicResolver extends AbstractResolver {
Message.error("\t"+getName()+": bad module name found in "+ivyRef.getResource()+": expected="+mrid.getName()+" found="+md.getModuleRevisionId().getName());
ok = false;
}
- if (ivyRef.getRevision() != null && !ivyRef.getRevision().startsWith("working@") && md.getModuleRevisionId().getRevision() != null &&
+ if (ivyRef.getRevision() != null && !ivyRef.getRevision().startsWith("working@") &&
!ModuleRevisionId.acceptRevision(ivyRef.getRevision(), md.getModuleRevisionId().getRevision())) {
Message.error("\t"+getName()+": bad revision found in "+ivyRef.getResource()+": expected="+ivyRef.getRevision()+" found="+md.getModuleRevisionId().getRevision());
ok = false;
}
if (!ok) {
- Message.verbose("\t"+getName()+": inconsistent module descriptor file found for "+mrid+" rejecting");
+ throw new ParseException("inconsistent module descriptor file found for "+mrid, 0);
}
- return ok;
}
protected void clearIvyAttempts() {
diff --git a/test/java/fr/jayasoft/ivy/ResolveTest.java b/test/java/fr/jayasoft/ivy/ResolveTest.java
index f6dc1528..96b27692 100644
--- a/test/java/fr/jayasoft/ivy/ResolveTest.java
+++ b/test/java/fr/jayasoft/ivy/ResolveTest.java
@@ -1554,6 +1554,21 @@ public class ResolveTest extends TestCase {
assertNotNull(report.getUnresolvedDependencies());
assertEquals("Number of unresolved dependencies not correct", 0, report.getUnresolvedDependencies().length);
}
+
+ public void testCheckRevision() throws Exception {
+ // mod12.2 depends on mod12.1 1.0 which depends on mod1.2
+ // mod12.1 doesn't have revision in its ivy file
+ ResolveReport report = _ivy.resolve(new File("test/repositories/2/mod12.2/ivy-1.0.xml").toURL(),
+ null, new String[] {"*"}, _cache, null, true);
+
+ assertTrue(report.hasError());
+
+ assertFalse(_ivy.getIvyFileInCache(_cache, ModuleRevisionId.newInstance("org12", "mod12.1", "1.0")).exists());
+ assertFalse(_ivy.getArchiveFileInCache(_cache, "org12", "mod12.1", "1.0", "mod12.1", "jar", "jar").exists());
+
+ assertFalse(_ivy.getIvyFileInCache(_cache, ModuleRevisionId.newInstance("org1", "mod1.2", "2.0")).exists());
+ assertFalse(_ivy.getArchiveFileInCache(_cache, "org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
+ }
////////////////////////////////////////////////////////////
// helper methods to ease the tests
diff --git a/test/repositories/2/mod12.1/ivy-1.0.xml b/test/repositories/2/mod12.1/ivy-1.0.xml
new file mode 100644
index 00000000..c113f397
--- /dev/null
+++ b/test/repositories/2/mod12.1/ivy-1.0.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/test/repositories/2/mod12.1/mod12.1-1.0.jar b/test/repositories/2/mod12.1/mod12.1-1.0.jar
new file mode 100644
index 00000000..56f3b36e
--- /dev/null
+++ b/test/repositories/2/mod12.1/mod12.1-1.0.jar
@@ -0,0 +1 @@
+
diff --git a/test/repositories/2/mod12.2/ivy-1.0.xml b/test/repositories/2/mod12.2/ivy-1.0.xml
new file mode 100644
index 00000000..ae24f393
--- /dev/null
+++ b/test/repositories/2/mod12.2/ivy-1.0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
diff --git a/test/repositories/2/mod12.2/mod12.1-1.0.jar b/test/repositories/2/mod12.2/mod12.1-1.0.jar
new file mode 100644
index 00000000..56f3b36e
--- /dev/null
+++ b/test/repositories/2/mod12.2/mod12.1-1.0.jar
@@ -0,0 +1 @@
+