Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiRelease Jars #59

Open
swalk243 opened this issue Jun 17, 2018 · 19 comments
Open

MultiRelease Jars #59

swalk243 opened this issue Jun 17, 2018 · 19 comments

Comments

@swalk243
Copy link

swalk243 commented Jun 17, 2018

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>
@swalk243
Copy link
Author

The ERROR is resulting from the call from meditect to jdeps :
Error: jaxb-xjc-2.4.0-b180608.0325.jar is a multi-release jar file but --multi-release option is not set

We have to check each Manifest for the entry: Multi-Release: true and then adding --multi-release 10 to the jdeps commandline call within moditect-plugin.

The call to " jdeps --generate-module-info C:\XXX\target\moditect --add-modules ..." has to be done separately for each jar in the dependency tree.

When we call " jdeps --multi-release 11 --generate-module-info C:\XXX\target\moditect --add-modules ..." with the full dependency tree at once we get the opposite Error:
Error: XXX.jar is not a multi-release jar file but --multi-release option is set

What do the experts think?

@malikoski
Copy link

Do you have a project to example to send?

@swalk243
Copy link
Author

swalk243 commented Aug 17, 2018

TestJAXB.zip

@agudian
Copy link

agudian commented Sep 21, 2018

This is caused by https://bugs.openjdk.java.net/browse/JDK-8207162, I think... :/

@gunnarmorling
Copy link
Member

Yes, that's a known issue with the current JDK 11.0.1. It will be fixed in 11.0.2.

@WarWolfen
Copy link

WarWolfen commented Feb 13, 2019

Hi everyone!
Unfortunatly, I got this issue with the latest build of OpenJDK 12. It complains about
https://mvnrepository.com/artifact/io.netty/netty-common/4.1.33.Final

being multi release and stops building there. I have sorted out a large number of dependencies from my project. It has been 10+ years and it was a lot of effort to get where I am now. My goal is to get the client to be linked into a runtime image.

Here is the project:
https://github.com/ClanWolf/C3-Starmap_Cerberus

The error occurs during the client build, running the install target on the main pom. As you can see in the pom of the client module, I used the jvmVersion parameter (with version 9 / 11 / 12) to no effect:
https://github.com/ClanWolf/C3-Starmap_Cerberus/blob/master/net.clanwolf.starmap.client/pom.xml
(line 189).

@WarWolfen
Copy link

this is the actual error:

[INFO] --- moditect-maven-plugin:1.0.0.Beta2:add-module-info (add-module-infos) @ net.clanwolf.starmap.client ---
writing to C:\C3\projects\C3-Starmap_Cerberus\net.clanwolf.starmap.client\target\moditect\io.netty.common\module-info.java
[INFO] Created module descriptor at C:\C3\projects\C3-Starmap_Cerberus\net.clanwolf.starmap.client\target\moditect\generated-sources\io.netty.common\module-info.java
Error: netty-common-4.1.33.Final.jar is a multi-release jar file but --multi-release option is not set

So, not exactly what I described before, sorry, I got confused... but still...

@WarWolfen
Copy link

this might belong to this:
#70

@WarWolfen
Copy link

?

@WarWolfen
Copy link

This is STILL not working.

@WarWolfen
Copy link

How am I supposed to solve this? I try to use Netty in a complex project and it simply denies to compile the thing. None of the netty jars is in my control. I have no idea how to make this work. Any help is much appreciated (the project is linked above for reference).

@gunnarmorling
Copy link
Member

gunnarmorling commented Mar 30, 2019 via email

@WarWolfen
Copy link

WarWolfen commented Mar 31, 2019

Thank you for the offer, I need to setup a new project to reproduce the error in an isolated context. I will let you know.

@WarWolfen
Copy link

This is driving me completly crazy! I have tried to separate the problem to an isolated environment, but it simply does not compute... Now moditect is complaining during the maven run about artefacts that are not even anywhere in the project!

I might just give up on the whole thing after all...

Error: jboss-marshalling-2.0.5.Final.jar is a multi-release jar file but --multi-release option is not set

jboss-marshalling not anywhere in the module and also not in the dependencies of the module...

@WarWolfen
Copy link

WarWolfen commented Apr 5, 2019

If you like to take a look still, please check out the io.nadron.client pom in the module io.nadron.client in the project here:
https://github.com/ClanWolf/C3-Starmap_Cerberus

The pom:
https://github.com/ClanWolf/C3-Starmap_Cerberus/blob/master/io.nadron.client/pom.xml

I believe it all might work if this module builds successfull...

@siordache
Copy link
Member

@WarWolfen With Java 12 I was able to circumvent the multi-release error by inserting the following snippet in the configuration of the add-module-info goal in io.nadron.client/pom.xml:

<jdepsExtraArgs>
  <arg>--multi-release</arg>
  <arg>9</arg>
</jdepsExtraArgs>

The add-module-info goal succeeds now but the build fails to execute create-runtime-image:

Error: automatic module cannot be used with jlink: org.apache.commons.collections4 from file:///D:/bds/C3-Starmap_Cerberus/net.clanwolf.starmap.client/target/modules/commons-collections4-4.3.jar 

Generating a module-info descriptor for this library should fix the problem. Looking forward to your feedback.

@WarWolfen
Copy link

Wow, thank you! I did not even know about this option. I will try it out tonight! Adding module info to the other jar should work like with the others after all... Will let you know. Where am I supposed to find the very existence of the configuration snippet you suggested?

@siordache
Copy link
Member

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

@WarWolfen
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants