我正在尝试将旧项目迁移到java 11中。
dependencies {
implementation ('com.google.code.findbugs:jsr305:3.0.2')
implementation ('javax.xml.ws:jaxws-api:2.3.1')
}这两种方法都包括注释和其他库对它们的抱怨如下:
error: module jsr305 reads package javax.annotation from both java.annotation and jsr305
error: module vboxjws reads package javax.annotation from both java.annotation and jsr305
error: module io.sentry reads package javax.annotation from both java.annotation and jsr305
error: module com.fasterxml.jackson.databind reads package javax.annotation from both java.annotation and jsr305
error: module com.fasterxml.jackson.dataformat.yaml reads package javax.annotation from both java.annotation and jsr305
error: module com.fasterxml.jackson.annotation reads package javax.annotation from both java.annotation and jsr305我发现的解决办法有3:
1
configurations.all {
exclude module: 'javax.annotation-api'
}2
configurations.all {
resolutionStrategy {
preferProjectModules()
dependencySubstitution {
substitute(module("javax.annotation:javax.annotation-api")).with(module("com.google.code.findbugs:jsr305:3.0.2"))
}}}3.
implementation ('javax.xml.ws:jaxws-api:2.3.1') {
exclude group: 'javax.annotation', module: 'javax.annotation-api'
}它们都导致了另一个错误:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.annotation not found, required by java.xml.ws这是一个例子,我在项目中有大约20个库,并且有多个冲突,我读到的另一个选项是手动将所有jars组合成一个,但是我真的很想避免这种情况。有办法解决这个问题吗?
发布于 2022-08-05 08:23:40
configurations {
all {
resolutionStrategy {
preferProjectModules()
dependencySubstitution {
substitute(module("jakarta.annotation:jakarta.annotation-api")).with(module("com.google.code.findbugs:jsr305:3.0.2"))
}
}
}}https://stackoverflow.com/questions/55118448
复制相似问题