From 826166a081fb847d4649a48f83651511ab3c4a2e Mon Sep 17 00:00:00 2001 From: Tran Ngoc Nhan Date: Wed, 22 Jan 2025 09:09:48 +0700 Subject: [PATCH] Fix gradle check with JDK17+ (#5735) The new version of the BND plugin does not have the same issue when running the `check` command, but the new version of the BND plugin requires JDK 17, so we can't use it when JDK 11 is being used to build the project. See gh-5599 --- build.gradle | 7 ++++++- gradle/libs.versions.toml | 1 + micrometer-osgi-test/build.gradle | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index b450198bfd..6fe5d7dc15 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,12 @@ buildscript { classpath libs.plugin.japicmp classpath libs.plugin.downloadTask classpath libs.plugin.spotless - classpath libs.plugin.bnd + + if (javaLanguageVersion.asInt() < 17) { + classpath libs.plugin.bnd + } else { + classpath libs.plugin.bndForJava17 + } constraints { classpath(libs.asmForPlugins) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7aad9ba761..0bfbc66aa7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -234,6 +234,7 @@ plugin-japicmp = { module = "me.champeau.gradle:japicmp-gradle-plugin", version plugin-downloadTask = { module = "de.undercouch:gradle-download-task", version = "5.6.0" } plugin-spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "6.25.0" } plugin-bnd = "biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0" +plugin-bndForJava17 = "biz.aQute.bnd:biz.aQute.bnd.gradle:7.1.0" [plugins] kotlin19 = { id = "org.jetbrains.kotlin.jvm", version = "1.9.25" } diff --git a/micrometer-osgi-test/build.gradle b/micrometer-osgi-test/build.gradle index d6ffd9152b..030623b352 100644 --- a/micrometer-osgi-test/build.gradle +++ b/micrometer-osgi-test/build.gradle @@ -26,8 +26,9 @@ dependencies { def testingBundle = tasks.register('testingBundle', Bundle) { archiveClassifier = 'tests' from sourceSets.test.output - sourceSet = sourceSets.test - + if (javaLanguageVersion.asInt() < 17) { + sourceSet = sourceSets.test + } bundle { bnd """\ Bundle-SymbolicName: \${task.archiveBaseName}-\${task.archiveClassifier}