fix: Version.jar should be resolved to id of self if null instead of the id of ancestor.

This commit is contained in:
huanghongxun
2021-07-25 01:21:08 +08:00
parent e34dd39b9a
commit 5de150b06e

View File

@@ -163,7 +163,7 @@ public class Version implements Comparable<Version>, Validation {
} }
public String getJar() { public String getJar() {
return jar; return jar == null ? id : jar;
} }
public String getInheritsFrom() { public String getInheritsFrom() {
@@ -275,14 +275,14 @@ public class Version implements Comparable<Version>, Validation {
if (inheritsFrom == null) { if (inheritsFrom == null) {
if (isRoot()) if (isRoot())
thisVersion = new Version(id).setPatches(patches).setJar(id); thisVersion = new Version(id).setPatches(patches);
else else
thisVersion = this.jar == null ? this.setJar(id) : this; thisVersion = this;
} else { } else {
// To maximize the compatibility. // To maximize the compatibility.
if (!resolvedSoFar.add(id)) { if (!resolvedSoFar.add(id)) {
Logging.LOG.log(Level.WARNING, "Found circular dependency versions: " + resolvedSoFar); Logging.LOG.log(Level.WARNING, "Found circular dependency versions: " + resolvedSoFar);
thisVersion = this.jar == null ? this.setJar(id) : this; thisVersion = this;
} else { } else {
// It is supposed to auto install an version in getVersion. // It is supposed to auto install an version in getVersion.
thisVersion = merge(provider.getVersion(inheritsFrom).resolve(provider, resolvedSoFar), false); thisVersion = merge(provider.getVersion(inheritsFrom).resolve(provider, resolvedSoFar), false);