Skip to content
Permalink
Browse files

[JENKINS-17775] If MavenProject.getParent throws ISE during fingerpri…

…nting, 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).
  • Loading branch information
jglick committed Apr 29, 2013
1 parent 7abd089 commit d477296ffd3114f9f8416981f82e49cace605600
Showing with 17 additions and 4 deletions.
  1. +3 −0 changelog.html
  2. +14 −4 maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java
@@ -70,6 +70,9 @@ <h3><a name=v1.514>What's new in 1.514</a> <!--=DATE=--></h3>
<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 boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo moj
*/
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 Void call(MavenBuild build) throws IOException, InterruptedException {
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 @@ private void recordParents(MavenBuildProxy build, MavenProject pom) throws IOExc
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) {

0 comments on commit d477296

Please sign in to comment.
You can’t perform that action at this time.