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.

Moditect Vert.x Web Example

See original GitHub issue

Hi,

I’m currently trying to setup a Vert.x Web example which uses the maven plugin and add-module-info to generate the module descriptors so that I can build a runtime image.

For Vert.x core this works without any issue but once I add Vert.x Web I ran into a strange issue.

Somehow moditect is picking up a dependency which is not actually part of the dependency tree.

This might happen because Vert.x web has a pom dependency/managed dependency but I’m not sure. I tried to explicitly adding the groovy dependency to my project and also provide a module configuration for it but that did not work.

[ERROR] Failed to execute goal org.moditect:moditect-maven-plugin:1.0.0.Beta1:add-module-info (add-module-info-to-dependencies) on project vertx-graalvm-native-image-test-app: 
Execution add-module-info-to-dependencies of goal org.moditect:moditect-maven-plugin:1.0.0.Beta1:add-module-info failed: 
Unable to derive module descriptor for /home/jotschi/.m2/repository/org/codehaus/groovy/groovy-all/2.4.7/groovy-all-2.4.7.jar: 
Provider class moduleName=groovy-all not in module -> [Help 1]

Any hint would be appreciated. We are also discussing the issue within this Vert.x Thread: https://groups.google.com/forum/#!topic/vertx/uIUAMaZLaec

A reproducer can be found in my vertx-graalvm-native-image-test repo within the dev-moditect branch.

https://github.com/Jotschi/vertx-graalvm-native-image-test/tree/dev-moditect

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jeremy-flortecommented, Jul 1, 2020

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.

0reactions
gunnarmorlingcommented, Dec 16, 2018

Cool, thanks for the heads-up!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vert.x Web
Here's a simple router example: HttpServer server = vertx. createHttpServer(); Router router = Router. router(vertx); router.
Read more >
eclipse-vertx/vertx-users - Gitter
@vietj That's strange. I just tried Moditect and it somehow wants to add a module info for groovy. Has vert.x web a groovy...
Read more >
Issue with Java module system and Vert.x CodeGen
Issue with Java module system and Vert.x CodeGen ... So I tried with a clean sample project that comes from Vert.X "how to":...
Read more >
Introduction to Vert.x - Baeldung
Learn how the use Vert.x - the open source, reactive and polyglot ... Vert.x, cover its core concepts and create a simple RESTfull...
Read more >
Using Eclipse Vert.x API from a Quarkus Application
/vertx/web uses the Vert.x Web Client to retrieve data from Wikipedia. Architecture of the Vert.x ... However, you can go right to the...
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