mirror of https://github.com/apache/ant-ivy
FIX: resolve fails without appropriate message when cache is empty and a module in the repository has no revision (IVY-165)
git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/trunk@484198 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
040dbc4146
commit
9ab9779e58
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
<ivy-module version="1.0">
|
||||
<info organisation="org12"
|
||||
module="mod12.1"
|
||||
status="integration"
|
||||
/>
|
||||
<dependencies>
|
||||
<dependency org="org1" name="mod1.2" rev="2.0"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
@ -0,0 +1 @@
|
|||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<ivy-module version="1.0">
|
||||
<info organisation="org12"
|
||||
module="mod12.2"
|
||||
status="integration"
|
||||
revision="1.0"
|
||||
/>
|
||||
<dependencies>
|
||||
<dependency name="mod12.1" rev="1.0"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
@ -0,0 +1 @@
|
|||
|
||||
Loading…
Reference in New Issue