Skip to content

Commit

Permalink
Fixing option --source cannot be used together with --release error
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Venmany <[email protected]>
  • Loading branch information
arunvenmany-ibm committed Dec 3, 2024
1 parent a9279a2 commit 920a801
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1705,22 +1705,23 @@ private JavaCompilerOptions getMavenCompilerOptions(MavenProject currentProject)
compilerOptions.setShowWarnings(showWarningsBoolean);
}

String source = getCompilerOption(configuration, "source", "maven.compiler.source", currentProject);
if (source != null) {
getLog().debug("Setting compiler source to " + source);
compilerOptions.setSource(source);
}

String target = getCompilerOption(configuration, "target", "maven.compiler.target", currentProject);
if (target != null) {
getLog().debug("Setting compiler target to " + target);
compilerOptions.setTarget(target);
}

String release = getCompilerOption(configuration, "release", "maven.compiler.release", currentProject);
if (release != null) {
getLog().debug("Setting compiler release to " + release);
getLog().debug("Compiler options source and target will be ignored");
compilerOptions.setRelease(release);
}else {
// add source and target only if release is not set
String source = getCompilerOption(configuration, "source", "maven.compiler.source", currentProject);
if (source != null) {
getLog().debug("Setting compiler source to " + source);
compilerOptions.setSource(source);
}
String target = getCompilerOption(configuration, "target", "maven.compiler.target", currentProject);
if (target != null) {
getLog().debug("Setting compiler target to " + target);
compilerOptions.setTarget(target);
}
}

String encoding = getCompilerOption(configuration, "encoding", "project.build.sourceEncoding", currentProject);
Expand Down

0 comments on commit 920a801

Please sign in to comment.