File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
src/main/java/org/jenkinsci/maven/plugins/hpi Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,20 @@ public void execute() throws MojoExecutionException {
42
42
throw new MojoExecutionException ("Java " + javaVersion + " or later is necessary to build this plugin." );
43
43
}
44
44
writeProfileMarker (javaVersion );
45
- setProperty ("maven.compiler.release" , Integer .toString (javaVersion .toReleaseVersion ()));
46
- setProperty ("maven.compiler.testRelease" , Integer .toString (javaVersion .toReleaseVersion ()));
45
+ if (!project .getProperties ()
46
+ .getProperty ("maven.compiler.release" )
47
+ .equals (Integer .toString (javaVersion .toReleaseVersion ()))) {
48
+ // Apply the profile to the in-memory model.
49
+ setProperty ("maven.compiler.release" , Integer .toString (javaVersion .toReleaseVersion ()));
50
+ setProperty ("maven.compiler.testRelease" , Integer .toString (javaVersion .toReleaseVersion ()));
51
+
52
+ // Unfortunately, I see no way to update the Enforcer configuration without restarting Maven.
53
+ // In the meantime, skip this rule in the current invocation to avoid a false positive.
54
+ if (!project .getProperties ().containsKey ("enforcer.skipRules" )) {
55
+ getLog ().warn ("Skipping enforceBytecodeVersion; will run on next invocation." );
56
+ project .getProperties ().setProperty ("enforcer.skipRules" , "enforceBytecodeVersion" );
57
+ }
58
+ }
47
59
48
60
if (new VersionNumber (findJenkinsVersion ()).compareTo (new VersionNumber ("2.361" )) < 0 ) {
49
61
throw new MojoExecutionException ("This version of maven-hpi-plugin requires Jenkins 2.361 or later" );
You can’t perform that action at this time.
0 commit comments