Skip to content

Commit

Permalink
EnforceBytecodeVersion fails with "Restricted to JDK 11 yet […] con…
Browse files Browse the repository at this point in the history
…tains […] targeted to JDK 17" (#582)
  • Loading branch information
basil authored Feb 22, 2024
1 parent 4ed686b commit 47b6b67
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 74 deletions.
73 changes: 0 additions & 73 deletions src/main/java/org/jenkinsci/maven/plugins/hpi/InitializeMojo.java

This file was deleted.

10 changes: 10 additions & 0 deletions src/main/java/org/jenkinsci/maven/plugins/hpi/ValidateMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public void execute() throws MojoExecutionException {
throw new MojoExecutionException("Java " + javaVersion + " or later is necessary to build this plugin.");
}
writeProfileMarker(javaVersion);
setProperty("maven.compiler.release", Integer.toString(javaVersion.toReleaseVersion()));
setProperty("maven.compiler.testRelease", Integer.toString(javaVersion.toReleaseVersion()));

if (new VersionNumber(findJenkinsVersion()).compareTo(new VersionNumber("2.361")) < 0) {
throw new MojoExecutionException("This version of maven-hpi-plugin requires Jenkins 2.361 or later");
Expand Down Expand Up @@ -149,6 +151,14 @@ private static void delete(Path p) throws MojoExecutionException {
}
}

private void setProperty(String key, String value) {
String currentValue = project.getProperties().getProperty(key);
if (currentValue == null || !currentValue.equals(value)) {
getLog().info("Setting " + key + " to " + value);
project.getProperties().setProperty(key, value);
}
}

private void check(String tag, String value, String badStart, String goodStart, String reason) {
if (value.startsWith(badStart)) {
String goodValue = goodStart + value.substring(badStart.length());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ static Map<String, LifecyclePhase> getBindings() {
"validate",
new LifecyclePhase(
"org.jenkins-ci.tools:maven-hpi-plugin:validate,org.jenkins-ci.tools:maven-hpi-plugin:validate-hpi"));
bindings.put("initialize", new LifecyclePhase("org.jenkins-ci.tools:maven-hpi-plugin:initialize"));
bindings.put(
"process-resources",
new LifecyclePhase("org.apache.maven.plugins:maven-resources-plugin:2.6:resources"));
Expand Down

0 comments on commit 47b6b67

Please sign in to comment.