java - 使用带有 java9+ 的 gradle 的自动模块的依赖性问题
问题描述
我正在尝试将旧项目迁移到 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 个库并且有多个冲突,我读到另一种选择是手动将所有 jar 合并为一个,但我真的很想避免这种情况。有没有办法在gradle中解决这个问题?
解决方案
推荐阅读
- stata - AME-dy/dx 之后的 Suest 不为 suest 保存
- python-3.x - 几次干净运行后看到 UnboundLocalError
- visual-studio - 如果可以的话,我可以在 Visual Studio 中使用 matlab 工具箱代码(k-wave)吗?我该如何实现?
- typescript - 从字符串日期中删除时间数据
- celery - 间歇性“无结果后端”异常
- neo4j - 使neo4j列表中存在的元素之间的所有关系
- html - Github 页面给了我 404 而不是链接到不同的页面
- python - 获取列中每个值的行数
- python - fbprophet:评估模型对数概率的错误:非有限梯度
- python - 在python中创建一个列来对数值进行分类