Skip to content

Commit

Permalink
Merge pull request OpenLiberty#1849 from arunvenmany-ibm/release_flag…
Browse files Browse the repository at this point in the history
…_issue_fix

 Fixing option --source cannot be used together with --release error
  • Loading branch information
cherylking authored Dec 3, 2024
2 parents a9279a2 + 9ed33f8 commit 0f90be0
Showing 1 changed file with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1705,22 +1705,28 @@ private JavaCompilerOptions getMavenCompilerOptions(MavenProject currentProject)
compilerOptions.setShowWarnings(showWarningsBoolean);
}

String release = getCompilerOption(configuration, "release", "maven.compiler.release", currentProject);
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);
if (source != null) {
getLog().debug("Compiler option source will be ignored since release is specified");
}
if (target != null) {
getLog().debug("Compiler option target will be ignored since release is specified");
}
compilerOptions.setRelease(release);
} else {
// add source and target only if release is not set
if (source != null) {
getLog().debug("Setting compiler source to " + source);
compilerOptions.setSource(source);
}
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 0f90be0

Please sign in to comment.