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).
Originally-Committed-As: d477296ffd3114f9f8416981f82e49cace605600
  • Loading branch information
jglick committed Apr 29, 2013
1 parent e218775 commit b4ae662e415ce1c24a61d254af7438722ca7ba0a
Showing with 14 additions and 4 deletions.
  1. +14 −4 src/main/java/hudson/maven/reporters/MavenFingerprinter.java
@@ -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 b4ae662

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