From f4ddd3b597210f7a05b5b90941d18a1552744e24 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 9 Aug 2022 21:58:35 +0100 Subject: [PATCH] Fix EhCache smoke test when building with a toolchain --- .../spring-boot-smoke-test-cache/build.gradle | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-cache/build.gradle b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-cache/build.gradle index 26b561cb5c..f7a4f9d1af 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-cache/build.gradle +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-cache/build.gradle @@ -21,6 +21,10 @@ configurations { infinispan } +def javaVersion() { + project.extensions.java.toolchain.languageVersion.map({ it.asInt() }).getOrElse(JavaVersion.current().majorVersion) +} + dependencies { implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-actuator")) implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-cache")) @@ -37,9 +41,7 @@ dependencies { ehcache(enforcedPlatform(project(":spring-boot-project:spring-boot-dependencies"))) ehcache("javax.cache:cache-api") ehcache("org.ehcache:ehcache") - if (JavaVersion.current().java11Compatible) { - ehcache("org.glassfish.jaxb:jaxb-runtime") - } + ehcache(provider({ (javaVersion() >= 11) ? "org.glassfish.jaxb:jaxb-runtime" : null })) ehcache2(enforcedPlatform(project(":spring-boot-project:spring-boot-dependencies"))) ehcache2("net.sf.ehcache:ehcache")