mac java 9 gradle ClassNotFoundException: javax.xml.bind.JAXBElement when building

Viewed 6543

I'm trying to build a gradle project on Mac with Java 9, but I'm getting this error:

FAILURE: Build failed with an exception.

Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBElement

Java version is:

java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

How do I add JAXB to the classpath? This projects builds on Windows and other computers OK without adding JAXB.

3 Answers

You can add the following under dependencies block to solve missing JAXBElement:

runtime('javax.xml.bind:jaxb-api')

Related