From 920a80140fcc4177d7ef0395968fbe4e07137029 Mon Sep 17 00:00:00 2001 From: Arun Venmany Date: Tue, 3 Dec 2024 18:34:36 +0530 Subject: [PATCH] Fixing option --source cannot be used together with --release error Signed-off-by: Arun Venmany --- .../tools/maven/server/DevMojo.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java index 67e2ed601..d753b41d1 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java @@ -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);