I try to build an already existing project with the JDK 9 and gradle.
I think I have a problem with the module loading.
Here is a sample of my gradle dependencies :
compile("org.springframework:spring-context:${spring_version}"){
exclude group: 'commons-logging', module: 'commons-logging'
}
compile("org.springframework.data:spring-data-jpa:${spring_data_version}"){
exclude group: 'commons-logging', module: 'commons-logging'
}
compile ("org.apache.commons:commons-dbcp2:${commons_dbcp2_version}"){
exclude group: 'commons-logging', module: 'commons-logging'
}
compile ("org.hibernate:hibernate-entitymanager:${hibernate_version}"){
exclude group: 'org.jboss.spec.javax.transaction'
}
compile ("org.hibernate:hibernate-java8:${hibernate_version}"){
exclude group: 'org.jboss.spec.javax.transaction'
}
When I try to build, I get the following error when running the tests:
java.lang.NoClassDefFoundError: javax/transaction/SystemException
So one solution was to also include the following dependency :
compile "javax.transaction:jta:1.1"
And the build now exits with the module duplication error like this :
error: module flyway.core reads package javax.transaction.xa from both jta and java.sql
error: module hibernate.jpa reads package javax.transaction.xa from both jta and java.sql
error: module hibernate.entitymanager reads package javax.transaction.xa from both jta and java.sql
I also tried to include the option --add-modules java.se.ee , but it still does not work.
To resume my question : I need to have the java.sql in my module-info.java but I also need the javax.transaction:jta dependency jar and this jar conflicts with the java.sql module.
Any help will be appreciated !