我使用Spring 5,Java 10和Gradle 4.8
我面临以下问题:
java.lang.ClassNotFoundException: org.aspectj.util.PartialOrder$PartialComparable
我在堆栈上读取溢出以添加:
compile group: 'org.aspectj', name: 'aspectjweaver', version: '1.9.1'
但是,当我这样做时,会出现100个错误,例如:
error: module java.persistence reads package org.aspectj.internal.lang.reflect from both aspectjrt and org.aspectj.weaver
如何解决此问题?
依赖项:
compile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.5'
compile group: 'org.springframework', name: 'spring-core', version: '5.0.7.RELEASE'
compile group: 'org.springframework', name: 'spring-context', version: '5.0.7.RELEASE'
compile group: 'org.springframework', name: 'spring-context-support', version: '5.0.7.RELEASE'
compile group: 'org.postgresql', name: 'postgresql', version: '42.2.1'
compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '2.0.8.RELEASE'
compile group: 'io.projectreactor', name: 'reactor-core', version: '3.1.8.RELEASE'
compile group: 'org.springframework.security', name: 'spring-security-core', version: '5.0.6.RELEASE'
compile group: 'org.springframework.security', name: 'spring-security-config', version: '5.0.6.RELEASE'
compile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.3.1.Final'
compile group: 'org.hibernate', name: 'hibernate-hikaricp', version: '5.3.1.Final'
compile group: 'org.hibernate.validator', name: 'hibernate-validator', version: '6.0.10.Final'
compile group: 'org.glassfish', name: 'javax.el', version: '3.0.1-b08'
compile group: 'com.github.ben-manes.caffeine', name: 'caffeine', version: '2.6.2'
compile group: 'org.aspectj', name: 'aspectjrt', version: '1.9.1'
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.28'
compile group: 'javax.mail', name: 'javax.mail-api', version: '1.6.2'
compile group: 'javax.activation', name: 'activation', version: '1.1.1'
答案 0 :(得分:0)
问题在于spring-data-jpa具有aspectjrt版本1.8.x的依赖关系(据我估计)尚未准备好进行Java9模块化。我从依赖项中排除了它,并包括了Aspectjrt和Weaver的正确版本,并且现在可以使用了。