HHH-12946 Remove unnecessary dependencies when building with JDK9+

We don't need to depend on JAXB's compiler (XJC) in our modules,
we just need the dependency in specific tasks during the build.
In particular we don't want users to transitively depend on XJC.

Also, we don't need an explicit dependency to JAXB in every module,
having one in hibernate-core is enough.
This commit is contained in:
Yoann Rodière 2018-10-15 10:55:56 +02:00 committed by Guillaume Smet
parent f9609f93b2
commit e6cd7d8495
3 changed files with 11 additions and 21 deletions

View File

@ -108,35 +108,20 @@ dependencies {
testRuntime( libraries.hana )
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Java 9 ftw!
if ( JavaVersion.current().isJava9Compatible() ) {
// The JDK used to run Gradle is Java 9+, and we assume that that is the same
// JDK for executing tasks
compile( libraries.jaxb_api )
compile( libraries.jaxb_runtime )
compile( libraries.jaxb_xjc )
compile( libraries.jaxb2_basics )
compile( libraries.jaxb2_basics_ant )
// In order for code generated by jpamodelgen to be compiled successfully,
// we need the @javax.annotation.Generated annotation to be in the classpath,
// and it's no longer in the JDK starting with JDK9
// (though @javax.annotation.processing.Generated is available in JDK9).
// Thus we need an additional dependency.
// See also https://hibernate.atlassian.net/browse/HHH-12990
compile( libraries.jsr250_api )
testCompile( libraries.jaxb_api )
testCompile( libraries.jaxb_runtime )
testCompile( libraries.jaxb_xjc )
testCompile( libraries.jaxb2_basics )
testCompile( libraries.jaxb2_basics_ant )
testCompile( libraries.jsr250_api )
testRuntime( libraries.jaxb_api )
testRuntime( libraries.jaxb_runtime )
testRuntime( libraries.jaxb_xjc )
testRuntime( libraries.jaxb2_basics )
testRuntime( libraries.jaxb2_basics_ant )
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Mac-specific
project.ext.toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar")
if ( project.toolsJar.exists() ) {

View File

@ -27,6 +27,9 @@ dependencies {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Java 9 ftw!
if ( JavaVersion.current().isJava9Compatible() ) {
compile( libraries.jaxb_api )
compile( libraries.jaxb_runtime )
xjc( libraries.jaxb_runtime )
xjc( libraries.jaxb_xjc )
xjc( libraries.jaxb2_basics )

View File

@ -24,6 +24,8 @@ dependencies {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Java 9 ftw!
if ( JavaVersion.current().isJava9Compatible() ) {
compile( libraries.jaxb_api )
xjc( libraries.jaxb_runtime )
xjc( libraries.jaxb_xjc )
xjc( libraries.jaxb2_basics )