Giter Club home page Giter Club logo

Comments (8)

Jotschi avatar Jotschi commented on May 17, 2024

We were able to solve the issue by manually specifying the descriptor for vertx-web. That workaround solved the issue. I'm closing the issue. Feel free to open it again if you want to check up on the actual cause of the problem.

from moditect.

gunnarmorling avatar gunnarmorling commented on May 17, 2024

from moditect.

Jotschi avatar Jotschi commented on May 17, 2024

@gunnarmorling

Sure:

git clone [email protected]:Jotschi/vertx-graalvm-native-image-test.git
git checkout 10ef164d6ccda768abed387e3ee84514487b8885
cd app
mvn clean package

The dev-moditect branch already contains the fixed version.

BTW: Your devoxx presentation about moditect was super helpful. I'm thinking about writing a blogpost to showcase how to deal with older libs in a JMPS environment.

from moditect.

gunnarmorling avatar gunnarmorling commented on May 17, 2024

Sure: ...

Cool, I'll take a look. Curious what's going on there.

BTW: Your devoxx presentation about moditect was super helpful.

Thanks, very happy to hear that!

I'm thinking about writing a blogpost to showcase how to deal with older libs in a JMPS environment.

That'd be cool. Let me know if you do it and would like some help with reviewing etc. There are some limitations with retrofitting existing JARs as modules via ModiTect (e.g. thinking of split packages or certain APIs that behave differently when being called from within a named module), but for sure it's a useful tool in the box.

I'll re-open the issue so to have a reminder for this problem.

from moditect.

gunnarmorling avatar gunnarmorling commented on May 17, 2024

Hey @Jotschi, did you ever have a chance to follow up on

I'm thinking about writing a blogpost to showcase how to deal with older libs in a JMPS environment.

?

from moditect.

Jotschi avatar Jotschi commented on May 17, 2024

@gunnarmorling No, unfortunately I did not yet have time write a blog post.

I had to postpone the Java update of the product I'm working on. I first need to update some dependencies which turned out to be rather complicated. Once that has been done I'll pick up the task and write a blog post along with the upgrade I'm doing. I'll keep you in the loop.

from moditect.

gunnarmorling avatar gunnarmorling commented on May 17, 2024

from moditect.

jeremy-florte avatar jeremy-florte commented on May 17, 2024

Hi, the example your provided (thank a lot by the way) works until a Vert.x version <= 3.8.0.
From Vert.X version 3.8.1, Netty version uses some graalvm dependencies to be able to produce native images and it requires some updates.

NB: Change comes from Netty version 4.1.36.Final

Here is a "minimal" pom I tried:

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>de.jotschi.vertx</groupId>
    <artifactId>vertx-moditect-jlink-example</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <properties>
        <!-- marker: last working version = 3.8.0 / breaking = 3.8.1 -->
        <vertx.version>3.9.1</vertx.version>
        <svm.version>19.0.0</svm.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-web</artifactId>
            <version>${vertx.version}</version>
        </dependency>

    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <release>11</release>
                        <compilerArgs>
                            <compilerArg>--module-path</compilerArg>
                            <compilerArg>${project.build.directory}/modules</compilerArg>
                        </compilerArgs>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <version>1.0.0.RC1</version>
                <executions>
                    <execution>
                        <id>add-module-info-to-dependencies</id>
                        <phase>package</phase>
                        <configuration>
                            <outputDirectory>${project.build.directory}/modules</outputDirectory>
                            <modules>
                                <module>
                                    <artifact>
                                        <groupId>com.fasterxml.jackson.core</groupId>
                                        <artifactId>jackson-core</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>com.fasterxml.jackson.core</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>com.fasterxml.jackson.core</groupId>
                                        <artifactId>jackson-annotations</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>com.fasterxml.jackson.annotations</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>com.fasterxml.jackson.core</groupId>
                                        <artifactId>jackson-databind</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>com.fasterxml.jackson.databind</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>com.oracle.substratevm</groupId>
                                        <artifactId>svm</artifactId>
                                        <version>${svm.version}</version>
                                    </artifact>
                                    <moduleInfo>
                                        <name>svm</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-common</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>io.netty.common</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-buffer</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>io.netty.buffer</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-codec</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>io.netty.codec</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-resolver</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>io.netty.resolver</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-transport</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>io.netty.transport</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-codec-dns</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>io.netty.codec.dns</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-codec-http2</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>io.netty.codec.http2</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-resolver-dns</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>io.netty.resolver.dns</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-handler</artifactId>
                                    </artifact>
                                    <moduleInfoSource>
                                        module io.netty.handler {
                                        exports io.netty.handler.flow;
                                        exports io.netty.handler.flush;
                                        exports io.netty.handler.ipfilter;
                                        exports io.netty.handler.logging;
                                        exports io.netty.handler.ssl;
                                        exports io.netty.handler.ssl.ocsp;
                                        exports io.netty.handler.ssl.util;
                                        exports io.netty.handler.stream;
                                        exports io.netty.handler.timeout;
                                        exports io.netty.handler.traffic;
                                        }
                                    </moduleInfoSource>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-codec-socks</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>io.netty.codec.socks</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-handler-proxy</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>io.netty.handler.proxy</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.netty</groupId>
                                        <artifactId>netty-codec-http</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>io.netty.codec.http</name>
                                    </moduleInfo>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.vertx</groupId>
                                        <artifactId>vertx-web</artifactId>
                                    </artifact>
                                    <moduleInfoSource>
                                        open module vertx.web {
                                        requires vertx.core;
                                        requires io.netty.codec.http;

                                        exports io.vertx.ext.web;
                                        exports io.vertx.ext.web.handler;
                                        exports io.vertx.ext.web.impl;
                                        }
                                    </moduleInfoSource>
                                </module>
                                <module>
                                    <artifact>
                                        <groupId>io.vertx</groupId>
                                        <artifactId>vertx-core</artifactId>
                                    </artifact>
                                    <moduleInfo>
                                        <name>vertx.core</name>
                                        <requires>
                                            static log4j.api;
                                            static log4j;
                                            static slf4j.api;
                                            *;
                                        </requires>
                                        <exports>
                                            *;
                                        </exports>
                                        <uses>
                                            io.vertx.core.spi.VertxFactory;
                                            io.vertx.core.spi.VerticleFactory;
                                            io.vertx.core.spi.FutureFactory;
                                            io.vertx.core.spi.BufferFactory;
                                        </uses>
                                    </moduleInfo>
                                </module>
                            </modules>
                            <module>
                                <mainClass>de.jotschi.vertx.example.Runner</mainClass>
                                <moduleInfo>
                                    <name>de.jotschi.vertx.example</name>
                                    <exports>
                                        de.jotschi.vertx.example to io.vertx.core;
                                    </exports>
                                </moduleInfo>
                            </module>
                            <jdepsExtraArgs>
                                <arg>--multi-release</arg>
                                <arg>11</arg>
                            </jdepsExtraArgs>
                        </configuration>
                        <goals>
                            <goal>add-module-info</goal>
                        </goals>
                    </execution>
                    <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>de.jotschi.vertx.example</module>
                            </modules>
                            <launcher>
                                <name>helloWorld</name>
                                <module>de.jotschi.vertx.example</module>
                            </launcher>
                            <compression>2</compression>
                            <stripDebug>true</stripDebug>
                             <outputDirectory>${project.build.directory}/jlink-image</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

I tried several things but I'm stuck with this issue:

Execution add-module-info-to-dependencies of goal org.moditect:moditect-maven-plugin:1.0.0.RC1:add-module-info failed: Module format not recognized: /home/jflorte/.m2/repository/com/oracle/substratevm/svm-hosted-native-linux-amd64/19.0.0/svm-hosted-native-linux-amd64-19.0.0.tar.gz

It seems it tries to enrich a transitive dependency from com.oracle.substratevm:svm:19.0.0 but I don't know how to prevent the plugin from doing so.

If you have any idea, I'd be happy to investigate.

For the record, I also tried with newer versions of Vert.X. Jackson definition can be removed because they added module-info.java files. But the svm (and then asm) issue is still a blocker to me.

from moditect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.