gpt4 book ai didi

java - AspectJ Weaver & java 模块系统(spring + gradle),编译问题

转载 作者:行者123 更新时间:2023-12-03 05:42:08 25 4
gpt4 key购买 nike

我使用 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'

最佳答案

问题是 spring-data-jpa 具有 aspectjrt 版本 1.8.x 的依赖关系(我认为)还没有为 java9 模块化做好准备。我从依赖项中排除了它,并包含了 aspectjrt 和 weaver 的正确版本,它现在可以工作了。

关于java - AspectJ Weaver & java 模块系统(spring + gradle),编译问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52244442/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com