2

module-info.java in the various projects which comprise a working JAXB include:

    requires transitive jakarta.activation;

For example, https://github.com/eclipse-ee4j/jaxb-ri/blob/master/jaxb-ri/runtime/impl/src/main/java/module-info.java#L23

But under Java 10, when installing my project which uses JAXB, maven complains:

[ERROR] module org.jvnet.staxex reads package javax.activation from both java.activation and jakarta.activation
[ERROR] module com.sun.xml.bind reads package javax.activation from both java.activation and jakarta.activation
[ERROR] the unnamed module reads package javax.activation from both jakarta.activation and java.activation

Since I can't see how to hide java.activation, I started re-compiling the various JAXB projects so they require java.activation instead of jakarta.activation

This works, but it can't be the correct solution! How do I hide/exclude java.activation in Java 10? thanks.

ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155
JasonPlutext
  • 15,352
  • 4
  • 44
  • 84
  • 1
    If you change the scope of your JAXB dependencies to `runtime`, does it fix your problem? – ZhekaKozlov Feb 02 '19 at 16:29
  • if i change the scope of com.sun.xml.bind jaxb-impl to runtime, mvn says "module-info.java:[17,29] module not found: com.sun.xml.bind" – JasonPlutext Feb 04 '19 at 02:45
  • Do you really need this module? It is possible to avoid it? – ZhekaKozlov Feb 11 '19 at 08:16
  • For java 11, jaxb is using jakarta.activation and it works fine there, since there is no java.activation. But it seems the jaxb guys might not have addressed using Java 10? – JasonPlutext Feb 12 '19 at 02:41

1 Answers1

0

Try using this:

--patch-module java.activation=jakarta.activation-<version>.jar

jakarta.activation-<version>.jar Should be the filename of the jar

Zoe
  • 27,060
  • 21
  • 118
  • 148
vengat
  • 1