ModiTect not finding module dependencies
See original GitHub issueI’ve configured ModiTect to generate module-info.java
s for all my dependencies (that don’t have them) and that seems to be working; but when it comes to dependencies that do have them, it’s not finding them.
When I run mvn package
in my app it’s failing with:
[INFO] --- moditect-maven-plugin:1.0.0.Beta1:create-runtime-image (create-runtime-image) @ dashman ---
[ERROR] Error: Module tech.dashman.dashmancommon not found, required by tech.dashman.dashman`
Now, I know tech.dashman.dashmancommon
is a module and has a module-info.java
because I built it myself. How do I make ModiTect/Jlink find all the dependent modules in their original jars?
My under-construction ModiTect config looks like this:
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<version>1.0.0.Beta1</version>
<executions>
<execution>
<id>add-module-info-to-dependencies</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/modules</outputDirectory>
<overwriteExistingFiles>true</overwriteExistingFiles>
<modules>
<module>
<artifact>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.59</version>
</artifact>
<moduleInfoSource>
module bcprov.jdk15on {
exports org.bouncycastle.jce.provider;
exports org.bouncycastle.jce.spec;
exports org.bouncycastle.util.encoders;
}
</moduleInfoSource>
</module>
<module>
<artifact>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.0.5.RELEASE</version>
</artifact>
<moduleInfoSource>
module spring.core {
}
</moduleInfoSource>
</module>
<module>
<artifact>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.5.RELEASE</version>
</artifact>
<moduleInfoSource>
module spring.context {
}
</moduleInfoSource>
</module>
<module>
<artifact>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>1.2.2.RELEASE</version>
</artifact>
<moduleInfoSource>
module spring.retry {
}
</moduleInfoSource>
</module>
<module>
<artifact>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.5.RELEASE</version>
</artifact>
<moduleInfoSource>
module spring.web {
}
</moduleInfoSource>
</module>
<module>
<artifact>
<groupId>com.pubnub</groupId>
<artifactId>pubnub-gson</artifactId>
<version>4.19.0</version>
</artifact>
<moduleInfoSource>
module pubnub.gson {
}
</moduleInfoSource>
</module>
<module>
<artifact>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
</artifact>
<moduleInfoSource>
module com.fasterxml.jackson.core {
}
</moduleInfoSource>
</module>
<module>
<artifact>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-javafx</artifactId>
<version>2.1.1</version>
</artifact>
<moduleInfoSource>
module org.kordamp.ikonli.javafx {
}
</moduleInfoSource>
</module>
<module>
<artifact>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
<version>1.7.2</version>
</artifact>
<moduleInfoSource>
module io.sentry {
}
</moduleInfoSource>
</module>
<module>
<artifact>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.22.0-CR2</version>
</artifact>
<moduleInfoSource>
module javassist {
}
</moduleInfoSource>
</module>
<module>
<artifact>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</artifact>
<moduleInfoSource>
module java.validation {
}
</moduleInfoSource>
</module>
</modules>
</configuration>
</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>
<path>${project.build.directory}/classes</path>
</modulePath>
<modules>
<module>tech.dashman.dashman</module>
</modules>
<outputDirectory>${project.build.directory}/jlink-image</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
BTW, I posted this as a question in Stack Overflow: https://stackoverflow.com/questions/49716711/moditect-and-jlink-not-finding-module-dependencies
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (5 by maintainers)
Top Results From Across the Web
ModiTect and Jlink not finding module dependencies
The workaround is to use the maven-dependency plugin to copy them to a known directory which can be added to the module path....
Read more >Unable to import the Maven multi module successfully in ...
Unable to import the Maven multi module successfully in WSL2 if root Maven pom.xml use the module as a dependency ; Project, IntelliJ...
Read more >Containerizing Apps with jlink - Oracle Blogs
Adding Nonmodule Dependencies ... Unfortunately, jlink works only with modules and it will fail if not all dependencies are modules. The only way ......
Read more >Maintaining a medium-sized Java library in 2022 and beyond
Use properties and dependency management for versions; 2.2.2. ... actually and without joking, the module system.
Read more >Migrating to Java 9 Modules with ModiTect by Gunnar Morling
Find out how to generate descriptors based on your application's dependencies, add them to existing JARs and create a fully self-contained ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello guys, I just fixed the problem with the next trick that exports dependency libs to
target/lib
and uses these libs as another path inmodulePath
declaration.At this moment, this code WORKS! 🥇
Thanks, also, sometimes runtime image generation fails due to “duplicated” modules because the maven dependency plugin will also export the jars of the libs that we are “mocking” with moditect.
In this case the solution is include these conflictive artifact ids in the “excludeArtifactIds” commented section of the maven-dependency-plugin (only artifact ids, comma separated)