0

I have a legacy JavaFX app which compiles and runs correctly on JDK 1.8. To move to JDK 10 I've added these to the pom.xml:

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
</dependency>

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
        <configuration>
            <release>10</release>
            <compilerArgs>
                <arg>--add-modules</arg>
                <arg>javax.xml.bind</arg>
            </compilerArgs>
        </configuration>
    </plugin>

Running mvn clean install -DskipTests with JDK 10.0.1 and mvn 3.3.9 gives

module not found: javax.xml.bind

Do I need a newer version of maven? I can't find anything on the maven web site about JDK 10 version requirements.

It doesn't seem to be related to JavaFX. What am I missing?

mipa
  • 10,369
  • 2
  • 16
  • 35
Dean Schulze
  • 9,633
  • 24
  • 100
  • 165
  • 1
    Are you using the module path or just the classpath while compiling? And what's the idea behind `--add-modules` as well as an external dependency of `jaxb-api:2.3.0`? Btw maven 3.3.9 is almost 3 yrs old, why not try 3.5.x. – Naman Jun 30 '18 at 04:07
  • The module name is java.xml.bind, not javax.xml.bind. In any case, I assume you don't need the `--add-modules` here as you are adding the JAXB API to the class path (you'll need to add the JAXB implementation and JAF too). – Alan Bateman Jun 30 '18 at 06:54
  • Where is the answer? If you mean https://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j that give me different error. – Dean Schulze Jun 30 '18 at 20:42
  • I removed the duplicate dependency and now have --add-modules java.se.ee per the SO link above. Now it gives `package com.sun.tools.internal.xjc.reader.xmlschema.bindinfo does not exist` – Dean Schulze Jun 30 '18 at 20:43
  • Saw the link to the (incorrect) answer above. Nothing there works. Tried adding the dependencies in the middle of https://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j/48136912#48136912 but that gives the same error. Note that I'm using JDK 10, not JDK 9. JDK 10 seems to have created more problems with modules. – Dean Schulze Jun 30 '18 at 21:02

0 Answers0