question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MultiRelease Jars

See original GitHub issue

How can I setup moditect-maven-plugin create-runtime-image to handle multiRelease jars.

I have heard that these dependencies should be Java11 aware.

    <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>
    <dependencies>
           <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>     
    </dependencies>

I am trying a simple jaxb Project to test modularisation with java11.

I get this Error: Error: jaxb-xjc-2.4.0-b180608.0325.jar is a multi-release jar file but --multi-release option is not set

I am using Apache Netbeans 9.0 rc1. JDK 10.0.1

Compiler settings:

            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-compiler-plugin</artifactId>
               <version>3.7.0</version>
               <configuration>
                   <release>10</release>
               </configuration>
               <dependencies>
                   <dependency>
                       <groupId>org.ow2.asm</groupId>
                       <artifactId>asm</artifactId>
                       <version>6.2</version> <!-- Use newer version of ASM -->
                   </dependency>
               </dependencies>
           </plugin>

Moditect Settings:

            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <version>1.0.0.Beta1</version>
                <executions>
                    <execution>
                        <id>add-module-infos</id>
                        <phase>package</phase>
                        <goals>
                            <goal>add-module-info</goal>
                        </goals>
                        <configuration>
                            <jvmVersion>10</jvmVersion>
                            <module>
                                <mainClass>com.myexample.jaxbtest.MainApp</mainClass>
                                <moduleInfo>
                                    <name>com.myexample.jaxbtest</name>
                                    <exports>
                                        *;
                                    </exports>
                                </moduleInfo>
                            </module>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <version>1.0.0.Beta1</version>
                <executions>
                    <execution>
                        <id>create-runtime-image</id>
                        <phase>package</phase>
                        <goals>
                            <goal>create-runtime-image</goal>
                        </goals>
                        <configuration>
                            <modulePath>
                                <path>${project.build.directory}/modules</path>
                            </modulePath>
                            <modules>
                                <module>com.myexample.jaxbtest</module>
                            </modules>
                                <baseJdk>version=10,vendor=oracle,platform=windows</baseJdk>
                            <launcher>
                                <name>JaxbTest</name>
                                <module>com.myexample.jaxbtest</module>
                            </launcher>
                            <outputDirectory>
                                ${project.build.directory}/jlink-image
                            </outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:19 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
WarWolfencommented, Apr 6, 2019

Thank you a lot! I have it working now (checked in).

0reactions
siordachecommented, Apr 5, 2019

The jdepsExtraArgs option is mentioned on the ModiTect GitHub page. This option is also available for the generate-module-info goal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multi-Release Jar Files - Baeldung
The solution in Java 9 is to leave the original class untouched and instead create a new version using the new JDK and...
Read more >
Multi-release JARs - Good or bad idea? - The Gradle Blog
In a nutshell, multi-release jars allow you to package several versions of the same class, for consumption by different runtimes. For example, ...
Read more >
JAR File Specification
A multi-release JAR file allows for a single JAR file to support multiple major versions of Java platform releases. For example, a multi-release...
Read more >
JEP 238: Multi-Release JAR Files - OpenJDK
A multi-release JAR ("MRJAR") will contain additional directories for classes and resources specific to particular Java platform releases.
Read more >
How To Use Multi-release JARs To Target Multiple Java ...
Multi -release JARs allow you to create a single JAR that contains bytecode for several Java versions with jar --version 9 (or 10,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found