Skip to content

Commit

Permalink
Merge pull request #522 from jglick/nonfatal-snapshot-comparisons-JEN…
Browse files Browse the repository at this point in the history
…KINS-52665

[JENKINS-52665] Treat `*-SNAPSHOT` mismatches as nonfatal in `hpi:validate-hpi`
  • Loading branch information
jglick authored Oct 24, 2023
2 parents 19a091a + 3449d3a commit 4017b51
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.IOException;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
Expand Down Expand Up @@ -41,8 +42,14 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
}
if (coreVersion.compareTo(maxCoreVersion) < 0) {
throw new MojoExecutionException(
"Dependency " + maxCoreVersionArtifact + " requires Jenkins " + maxCoreVersion + " or higher.");
String error =
"Dependency " + maxCoreVersionArtifact + " requires Jenkins " + maxCoreVersion + " or higher.";
if (ArtifactUtils.isSnapshot(coreVersion.toString())
|| ArtifactUtils.isSnapshot(maxCoreVersion.toString())) {
getLog().warn(error);
} else {
throw new MojoExecutionException(error);
}
}
}

Expand Down

0 comments on commit 4017b51

Please sign in to comment.