From 0092653d42f61107b81ca41a1b8470f2fe433927 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Fri, 8 Jun 2018 13:37:44 +0200 Subject: [PATCH] Fix JDK9 build after Groovy 2.5 upgrade After the Groovy 2.5 upgrade, the Spring Framework build on JDK9 hit GROOVY-8631. Adding the relevant `jax-api` dependency to the module didn't fix this issue. The Groovy release notes mention the use of the `--add-modules` JVM flag, but this is not an option for this build which should run on JDK8 -> JDK11. This commit changes the dependency from `groovy-all` to more focused dependencies on Groovy in the `spring-beans` and `spring-context` modules. This change seems to avoid the automatic loading of Groovy enhancements to JAXB (shipped with `groovy-xml`). See: * http://groovy-lang.org/releasenotes/groovy-2.5.html#Groovy2.5releasenotes-Knownissues * https://issues.apache.org/jira/browse/GROOVY-8631 Issue: SPR-15407 --- spring-beans/spring-beans.gradle | 2 +- spring-context/spring-context.gradle | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-beans/spring-beans.gradle b/spring-beans/spring-beans.gradle index b8ead1ac61..e60972f9ad 100644 --- a/spring-beans/spring-beans.gradle +++ b/spring-beans/spring-beans.gradle @@ -6,7 +6,7 @@ dependencies { compile(project(':spring-core')) optional("javax.inject:javax.inject:1") optional("org.yaml:snakeyaml:1.21") - optional("org.codehaus.groovy:groovy-all:${groovyVersion}") + optional("org.codehaus.groovy:groovy-xml:${groovyVersion}") optional("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}") optional("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}") testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}") diff --git a/spring-context/spring-context.gradle b/spring-context/spring-context.gradle index 825953a1b7..ac6dec562e 100644 --- a/spring-context/spring-context.gradle +++ b/spring-context/spring-context.gradle @@ -17,12 +17,15 @@ dependencies { optional("javax.validation:validation-api:1.1.0.Final") optional("javax.xml.ws:jaxws-api:2.3.0") optional("org.aspectj:aspectjweaver:${aspectjVersion}") - optional("org.codehaus.groovy:groovy-all:${groovyVersion}") + optional("org.codehaus.groovy:groovy:${groovyVersion}") optional("org.beanshell:bsh:2.0b5") optional("joda-time:joda-time:2.10") optional("org.hibernate:hibernate-validator:5.4.2.Final") optional("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}") optional("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}") + testCompile("org.codehaus.groovy:groovy-xml:${groovyVersion}") + testCompile("org.codehaus.groovy:groovy-jsr223:${groovyVersion}") + testCompile("org.codehaus.groovy:groovy-test:${groovyVersion}") testCompile("org.apache.commons:commons-pool2:2.5.0") testCompile("javax.inject:javax.inject-tck:1") testRuntime("javax.xml.bind:jaxb-api:2.3.0")