13

I'm attempting an upgrade from the Java 8 version to 11 for a project and I've encountered the following error during build-time after I've manually added the JAXB dependencies:

'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

I'm using Gradle, so I've added the following dependencies:

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"

I've tried to scour the jaxb pom to search for the place in which the property it's looking for (tools.jar) is specified but couldn't find anything.

What am I doing wrong?

4 Answers 4

9

Just use 2.3+ version of jaxb-... artifacts. If we check jaxb-parent-2.3.0.pom then we see that it doesn't use <systemPath>${tools.jar}</systemPath> anymore

1
  • thank you!!! had the same jaxb complaint with java 1, groovy 3.0.8. went with groovy 2.3.6 via sdkman! :)
    – pangyuteng
    May 1, 2021 at 22:35
7

You can use ./gradlew dependencies to find the parent dependency of that jaxb dependency which caused the error.

Then upgrade that dependency to the latest.

For example to fix the error:

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
$ ./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

Here in my case jaxb-osgi is introduced by io.rest-assured:xml-path. So upgrading that dependency should fix it.

testImplementation 'io.rest-assured:xml-path:4.2.0'
2
  • I'm using io.rest-assured:xml-path:3.3.0 als part of spring-boot-starter-web -> 2.3.3.RELEASE and I still receive this error
    – themenace
    Sep 3, 2020 at 6:51
  • 1
    I am using rest-assured and this fixed it instantly. Thank you
    – Subhod I
    Jan 28, 2021 at 10:13
1

have same issue now , i just upgrade everthing in my gradle

implementation 'io.rest-assured:rest-assured:4.3.2'
implementation 'io.rest-assured:json-path:4.3.2'
compile group: 'com.sun.xml.bind', name: 'jaxb-osgi', version: '2.3.2'

the error disappear EDIT : for my project, if i used more updated version of jaxb-osgi , it wouldnt work (the error disappear but the test stop to run )

0

I found that adding

ext['rest-assured.version'] = '4.3.1'

to your build.gradle file will override the version which ships with your version of spring-cloud, and all the versions of io.rest-assured:** jars downloaded will have the same number

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.