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 920a801 commit c78541c
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1706,18 +1706,23 @@ private JavaCompilerOptions getMavenCompilerOptions(MavenProject currentProject)
}

String release = getCompilerOption(configuration, "release", "maven.compiler.release", currentProject);
String source = getCompilerOption(configuration, "source", "maven.compiler.source", currentProject);
String target = getCompilerOption(configuration, "target", "maven.compiler.target", currentProject);
if (release != null) {
getLog().debug("Setting compiler release to " + release);
getLog().debug("Compiler options source and target will be ignored");
if (source != null) {
getLog().debug("Compiler options source will be ignored since release is specified");
}
if (target != null) {
getLog().debug("Compiler options target will be ignored since release is specified");
}
compilerOptions.setRelease(release);
}else {
} 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);
Expand Down

0 comments on commit c78541c

Please sign in to comment.