From 2f4c35cb4e5bd842c52c92e5921ef799b0c46993 Mon Sep 17 00:00:00 2001 From: Remko Popma Date: Sun, 27 Aug 2023 05:36:19 +0900 Subject: [PATCH] BUILD target Java 17 in picocli-shell-jline3 build when possible --- dependencies.gradle | 6 +++--- picocli-shell-jline3/build.gradle | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index efa87ed1b..c5c5ff49b 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -3,9 +3,9 @@ // Spring Boot 3.0 requires Java 17 as a minimum version boolean useSpring3 = JavaVersion.current().majorVersion.compareTo("17") >= 0; -logger.quiet("JavaVersion=${JavaVersion.current()}") -logger.quiet("JavaVersion.majorVersion=${JavaVersion.current().majorVersion}") -logger.quiet("useSpring3=${useSpring3}") +logger.quiet("dependencies.gradle: JavaVersion=${JavaVersion.current()}") +logger.quiet("dependencies.gradle: JavaVersion.majorVersion=${JavaVersion.current().majorVersion}") +logger.quiet("dependencies.gradle: useSpring3=${useSpring3}") ext { // PICOCLI VERSION diff --git a/picocli-shell-jline3/build.gradle b/picocli-shell-jline3/build.gradle index b4f7692b0..a868e2e3b 100644 --- a/picocli-shell-jline3/build.gradle +++ b/picocli-shell-jline3/build.gradle @@ -7,8 +7,18 @@ description 'Picocli Shell JLine3 - easily build interactive shell applications version "$projectVersion" ext.moduleName = 'info.picocli.shell.jline3' -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +// Spring 3 requires Java 17 +boolean useJava17 = JavaVersion.current().majorVersion.compareTo("17") >= 0; +if (useJava17) { + logger.quiet("picocli-shell-jline3/build.gradle: JavaVersion=${JavaVersion.current()}") + logger.quiet("picocli-shell-jline3/build.gradle: sourceCompatibility = 17") + logger.quiet("picocli-shell-jline3/build.gradle: targetCompatibility = 17") + sourceCompatibility = 17 + targetCompatibility = 17 +} else { // from Java 9 and up + sourceCompatibility = 1.8 + targetCompatibility = 1.8 +} dependencies { api rootProject