我正在尝试将一个项目的 Java 8 版本升级到 11,在手动添加 JAXB 依赖项后,在构建时遇到以下错误:
'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} in com.sun.xml.bind:jaxb-impl:2.2.11
Run Code Online (Sandbox Code Playgroud)
我正在使用 Gradle,所以我添加了以下依赖项:
implementation "javax.xml.bind:jaxb-api:2.2.11"
implementation "com.sun.xml.bind:jaxb-core:2.2.11"
implementation "com.sun.xml.bind:jaxb-impl:2.2.11"
implementation "javax.activation:activation:1.1.1"
Run Code Online (Sandbox Code Playgroud)
我试图搜索 jaxb pom 以搜索它正在寻找的属性 ( tools.jar) 被指定但找不到任何东西的地方。
我究竟做错了什么?
只需使用 2.3+ 版本的jaxb-...工件。如果我们检查jaxb-parent-2.3.0.pom,然后我们可以看到,它不使用<systemPath>${tools.jar}</systemPath>了
您可以使用./gradlew dependencies来查找导致错误的 jaxb 依赖项的父依赖项。
然后将该依赖项升级到最新版本。
例如修复错误:
Errors occurred while build effective model from /home/gayanw/.gradle/caches/modules-2/files-2.1/com.sun.xml.bind/jaxb-osgi/2.2.10/c926a537af564ec047ec6308df1d0d2a03364a86/jaxb-osgi-2.2.10.pom:
'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} in com.sun.xml.bind:jaxb-osgi:2.2.10
Run Code Online (Sandbox Code Playgroud)
$ ./gradlew dependencies
| \--- io.rest-assured:xml-path:3.0.2 -> 3.3.0
| +--- org.codehaus.groovy:groovy-xml:2.4.15 -> 2.5.9 (*)
| +--- org.codehaus.groovy:groovy:2.4.15 -> 2.5.9
| +--- io.rest-assured:rest-assured-common:3.3.0 (*)
| +--- org.apache.commons:commons-lang3:3.4
| +--- org.ccil.cowan.tagsoup:tagsoup:1.2.1
| +--- javax.xml.bind:jaxb-api:2.2.12 -> 2.3.1
| | \--- javax.activation:javax.activation-api:1.2.0
| +--- com.sun.xml.bind:jaxb-osgi:2.2.10
Run Code Online (Sandbox Code Playgroud)
在我的情况下,这里jaxb-osgi是由io.rest-assured:xml-path. 因此,升级该依赖项应该可以修复它。
testImplementation 'io.rest-assured:xml-path:4.2.0'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7725 次 |
| 最近记录: |