Skip to content

Commit

Permalink
Print warning if using deprecated java.level with new enough parent…
Browse files Browse the repository at this point in the history
… POM (#320)
  • Loading branch information
basil committed Mar 30, 2022
1 parent a6c22b3 commit 5943af8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 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 @@ -5,6 +5,7 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProject;

/**
* Make sure that we are running in the right environment.
Expand All @@ -24,5 +25,16 @@ public void execute() throws MojoExecutionException {
if (new VersionNumber(findJenkinsVersion()).compareTo(new VersionNumber("2.204")) < 0) {
throw new MojoExecutionException("This version of maven-hpi-plugin requires Jenkins 2.204 or later");
}

MavenProject parent = project.getParent();
if (parent != null
&& parent.getGroupId().equals("org.jenkins-ci.plugins")
&& parent.getArtifactId().equals("plugin")
&& !parent.getProperties().containsKey("java.level")
&& project.getProperties().containsKey("java.level")) {
getLog().warn("Ignoring deprecated java.level property."
+ " This property should be removed from your plugin's POM."
+ " In the future this warning will be changed to an error and will break the build.");
}
}
}

0 comments on commit 5943af8

Please sign in to comment.