Treat Maven artifacts with bundle packaging as jars
Previously, LocalM2Resource used the pom's packaging configuration to determine the suffix of the file that it should look for, e.g. if the pom's packaging was jar, it would look for a file with a .jar suffix in artifactExists(). This logic fails for artifacts with bundle packaging as it would look for a .bundle file rather than a .jar file, fail to find the file, and incorrectly report that the artifact does not exist. This commit updates LocalM2Resource to look for a file with a .jar suffix when the packaging configuration in the pom is bundle.
This commit is contained in:
parent
35ff983b40
commit
b855ab6cae
|
|
@ -50,6 +50,7 @@ import org.apache.ivy.plugins.resolver.IBiblioResolver;
|
|||
import org.apache.ivy.util.AbstractMessageLogger;
|
||||
import org.apache.ivy.util.MessageLogger;
|
||||
import org.springframework.boot.cli.Log;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Customizes the groovy grape engine to enhance and patch the behavior of ivy. Can add
|
||||
|
|
@ -258,8 +259,7 @@ class GrapeEngineCustomizer {
|
|||
private boolean artifactExists() {
|
||||
if (this.artifactExists == null) {
|
||||
try {
|
||||
PomReader reader = new PomReader(getURL(), this);
|
||||
final String packaging = reader.getPackaging();
|
||||
final String packaging = getPackaging();
|
||||
if ("pom".equals(packaging)) {
|
||||
this.artifactExists = true;
|
||||
}
|
||||
|
|
@ -280,6 +280,15 @@ class GrapeEngineCustomizer {
|
|||
}
|
||||
return this.artifactExists;
|
||||
}
|
||||
|
||||
private String getPackaging() throws IOException, SAXException {
|
||||
PomReader reader = new PomReader(getURL(), this);
|
||||
String packaging = reader.getPackaging();
|
||||
if ("bundle".equals(packaging)) {
|
||||
packaging = "jar";
|
||||
}
|
||||
return packaging;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue