Search code examples
javajava-modulejava-10

Java 10: Replacement for java.xml.ws conflict


I have to use java.xml.ws* components in my project but because it's deprecated and will be removed soon I want to use replacement for these components. So I added this dependency to my project's pom file:

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-ri</artifactId>
    <version>2.3.0</version>
    <type>pom</type>
</dependency>

This is my module configuration:

module x.y.z {
    requires kotlin.stdlib;
    requires spring.boot;
    requires spring.boot.autoconfigure;
    requires spring.context;
    requires cxf.core;
    requires cxf.rt.frontend.jaxws;
    requires java.xml.ws;
}

But there is an error:

enter image description here

What does it mean and how to fix it so I can use my dependency above instead of java.xml.ws from jdk?


Solution

  • Just use Java 11 :) There is no javax.xml.ws module there, so no conflict.

    As for Java 10, the easiest workaround is to change the scope of jaxws-ri to runtime:

    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-ri</artifactId>
        <version>2.3.0</version>
        <scope>runtime</scope>
    </dependency>