带有gradle的Java 11:必须指定绝对路径,但必须为$ {tools.jar}

在使用jaxb的项目中,我们正在从Java 8迁移到11。由于已将其从JDK中删除,因此必须单独将其包含进来,这是通过gradle config完成的:

console.log('Image loaded')

我能够运行项目,但是compileJava gradle作业会引发错误:

compile("javax.xml.bind:jaxb-api:2.2.11")
compile("com.sun.xml.bind:jaxb-core:2.2.11")
compile("com.sun.xml.bind:jaxb-impl:2.2.11")

作业完成并创建了一个jar,但是在生产服务器上运行时,它会因以下错误而停止:

Errors occurred while build effective model from C:\Users\.\.gradle\caches\modules-2\files-2.1\com.sun.xml.bind\jaxb-core\2.2.11\db0f76866c6b1e50084e03ee8cf9ce6b19becdb3\jaxb-core-2.2.11.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-core:2.2.11
Errors occurred while build effective model from C:\Users\.\.gradle\caches\modules-2\files-2.1\com.sun.xml.bind\jaxb-impl\2.2.11\2d4b554997fd01d1a2233b1529b22fc9ecc0cf5c\jaxb-impl-2.2.11.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-impl:2.2.11

我正在使用Spring Boot v1.5.6和gradle 4.8.1

magiclvnan 回答:带有gradle的Java 11:必须指定绝对路径,但必须为$ {tools.jar}

解决方案是使用较新版本的jaxb库。 2.3.0不再使用tools.jar。

本文链接:https://www.f2er.com/3131535.html

大家都在问