I have 3 jar of jackson library
- jackson-core-2.8.10.jar
- jackson-annotations-2.8.0.jar
- jackson-databind-2.8.10.jar
I created module-info.java for both core and annotation successfully and converted them to Named maodule using jdeps.
for databind , I tried following command:
jdeps --generate-module-info . --module-path %JAVA_HOME%\jomds;jackson.core;jackson.annotations existingmods\jackson-databind-2.8.10.jar
Now following error is occuring :
Missing dependence: .\jackson.databind\module-info.java not generated
Error: missing dependencies
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonCreator not found
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonCreator$Mode not found
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonFormat not found
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonFormat$Value not found
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonIgnoreProperties not found
com.fasterxml.jackson.databind.AnnotationIntrospector -> com.fasterxml.jackson.annotation.JsonIgnoreProperties$Value not found.
How can I generate module-info.java for jackson-databind ?
The short answer is that, yes, you'll have to convert the libraries to explicit modules.
The
jlink
tool is intended to provide a trimmed binary image that has only the required modules. The issue is that automatic modules have access to the classpath (aka the unnamed module) which can read all JDK modules. So nothing would be trimmed.This thread states this as well, with a link to a YouTube video.
This example converts
commons-lang3-3.5.jar
to an explict module for ajlink
demo.Edit: to be more specific, here is an example script that converts, in order,
jackson-core
,jackson-annotations
, andjackson-databind
legacy jars to modular jars.The idea is:
jdeps --generate-module-info
on the legacy jarmodule-info.java
from above, re-compile, and re-zipThe trick is that modular jars with dependencies will require those dependencies as command-line parameters. For example, here is
jackson-databind
(abstracted somewhat):