提交 d477296f 编写于 作者: J Jesse Glick

[JENKINS-17775] If MavenProject.getParent throws ISE during fingerprinting,...

[JENKINS-17775] If MavenProject.getParent throws ISE during fingerprinting, report it but at least proceed.
Proper fix is to ensure that the model resolution uses the same environment as the actual build,
or is otherwise more lenient about finding the parent (e.g. enables plugin resolution).
上级 7abd0890
......@@ -70,6 +70,9 @@ Upcoming changes</a>
<li class=bug>
Third-party license display for core was broken since 1.506.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17724">issue 17724</a>)
<li class='major bug'>
Amelioration of exception from fingerprinting in a Maven project when a parent POM could not be located.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17775">issue 17775</a>)
<li class=bug>
NPE from <code>MatrixConfiguration.newBuild</code>.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17728">issue 17728</a>)
......
......@@ -107,7 +107,7 @@ public class MavenFingerprinter extends MavenReporter {
*/
public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener) throws InterruptedException, IOException {
recordParents(build, pom);
recordParents(build, pom, listener);
build.executeAsync(new BuildCallable<Void,IOException>() {
private static final long serialVersionUID = -1360161848504044869L;
......@@ -137,8 +137,8 @@ public class MavenFingerprinter extends MavenReporter {
return true;
}
private void recordParents(MavenBuildProxy build, MavenProject pom) throws IOException, InterruptedException {
MavenProject parent = pom.getParent();
private void recordParents(MavenBuildProxy build, MavenProject pom, BuildListener listener) throws IOException, InterruptedException {
MavenProject parent = getParent(pom, listener);
while (parent != null) {
File parentFile = parent.getFile();
......@@ -163,10 +163,20 @@ public class MavenFingerprinter extends MavenReporter {
record(parent.getGroupId() + ":" + parent.getArtifactId(),
parentFile, used);
}
parent = parent.getParent();
parent = getParent(parent, listener);
}
}
// XXX consider calling also from PomInfo which makes a naked call to getParent
private static MavenProject getParent(MavenProject pom, BuildListener listener) {
try {
return pom.getParent();
} catch (IllegalStateException x) { // MNG-5075
x.printStackTrace(listener.error("Warning: failed to resolve parent of " + pom.getId()));
return null;
}
}
private Artifact getArtifact(MavenProject parent) {
Artifact art = parent.getArtifact();
if (art == null) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册