javaee/jaxb-v2

Split package between jaxb-impl and jaxb-core prevents usage as JPMS module

gunnarmorling opened this issue · 6 comments

Hi, as Java 11 doesn't come with the java.xml.bind module any longer, I tried to add the JAXB RI as JPMS modules to my application. This failed though due to split packages between the following two artifacts:

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.3.0</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>2.3.0</version>
</dependency>

If these are not the correct artifacts to use, which ones should I be using instead? Dmitry was hinting on Twitter that the split package issue supposedly is resolved, so I might just be using wrong artifacts. Note I also tried

<dependency>
   <groupId>org.glassfish.jaxb</groupId>
   <artifactId>jaxb-runtime</artifactId>
   <version>2.3.0</version>
</dependency>

But this in turn pulled in core which again resulted in split package issues. Unfortunately, the user guide at https://javaee.github.io/jaxb-v2/doc/user-guide/ch03.html#deployment also doesn't provide instructions on how to use the JAXB RI as JPMS modules.

@bravehorsie, Dmitry was mentioning that you migt have the answer. Thanks for any help :)

Hi @gunnarmorling
in 2.3.0 release only jaxb-api is capable to be run as JPMS module. If you like to test RI, you have to build master or even better https://github.com/javaee/jaxb-v2/tree/update-mr-jar-build branch.

jaxb-impl and jaxb-core were merged in master, so split package problem no longer exists.

Here is a project which should prove most basic scenarios working on JPMS after jaxb is built from sources:
https://github.com/bravehorsie/metro-jpms-test

Hey @bravehorsie, is there any update on this one? I'd like to test some things on JDK 11, but the issue here is a blocker for that, as JAXB has been removed from the JDK but with the current released version (2.3.0) there doesn't seem to be a way to add the JAXB JARs as modules. And mixing module path and classpath is a pain with Maven, which will use either one of them but not both.

Hi @gunnarmorling

Please try 2.4.0-b180608.0325 - this is JPMS modularized RI working on JDKs with java.xml.bind module (9,10) and those without it (11-ea).

Either these artifacts in you maven project:

    <repositories>
        <repository>
            <id>releases.java.net</id>
            <url>http://maven.java.net/content/repositories/releases/</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>jvnet-nexus-staging</id>
            <url>http://maven.java.net/content/repositories/staging/</url>
            <layout>default</layout>
        </repository>
    </repositories>

       <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <version>2.4.0-b180608.0325</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-xjc</artifactId>
            <version>2.4.0-b180608.0325</version>
        </dependency>
       <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-jxc</artifactId>
            <version>2.4.0-b180608.0325</version>
        </dependency>

or download this binary distribution - https://maven.java.net/content/repositories/promoted/com/sun/xml/bind/jaxb-ri/2.4.0-b180608.0325/jaxb-ri-2.4.0-b180608.0325.zip

New beta released: 2.4.0-b180725.0644