Module commons.math3 not found using jdeps

1.2k views Asked by At

I'm using JDEPS to list the dependencies of libraries to ensure they are satisfied.

I've recently upgraded from Apache POI v4.1.1 to v5.0.0, where JigSaw modules were added.

Previously, the following command would output the dependencies:

jdeps --multi-release 11 poi-scratchpad-4.1.1.jar

But now using v5.0.0, I'm getting:

jdeps.exe --multi-release 11 poi-scratchpad-5.0.0.jar
Exception in thread "main" java.lang.module.FindException: Module commons.math3 not found, required by org.apache.poi.scratchpad
        at java.base/java.lang.module.Resolver.findFail(Resolver.java:894)
        at java.base/java.lang.module.Resolver.resolve(Resolver.java:191)
        at java.base/java.lang.module.Resolver.resolve(Resolver.java:140)
        at java.base/java.lang.module.Configuration.resolve(Configuration.java:422)
        at java.base/java.lang.module.Configuration.resolve(Configuration.java:256)
        at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration$Builder.build(JdepsConfiguration.java:564)
        at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.buildConfig(JdepsTask.java:603)
        at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:557)
        at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:533)
        at jdk.jdeps/com.sun.tools.jdeps.Main.main(Main.java:49)

I have the commons-math3 library, but even when I include it via the -classpath argument, I'm still getting the same issue.

1

There are 1 answers

5
Naman On

Using --module-path instead of the -classpath option for the module to be resolved for commons-math3-3.6.1.jar should work for you.

In practice, you can detail all the dependencies into a single folder for simplicity and then treat that as modulepath such as following:

enter image description here

In the above image, I have created a dependencies folder that includes the .jars for all dependent libraries for poi-scratchpad. Further executing the following command from the same directory works:

jdeps --module-path dependencies poi-scratchpad-5.0.0.jar