I'm struggling with jdeps
. Java 17.
I have a modular app, with a single module and single module-info.java. It works fine.
I'm trying to run jdeps
in order to find the required JDK modules so I can use it with jlink
.
When I run this command:
jdeps --multi-release 17 --ignore-missing-deps --print-module-deps --class-path 'target/libs/*' target/classes
It gives me this exception message: Exception in thread "main" java.lang.module.FindException: Module jakarta.json.bind not found, required by MyModule
The libs directory has all of the dependency jar files copied into it, and target/classes is my code and such. I do, indeed, have a jar with the jakarta.json.bind
module.
Now, when I remove the module-info.class file from my build, thus making it a "non-modular" project (as far as I can tell, this is the only difference between a modular and non-modular project), I run jdeps
again.
jdeps --multi-release 17 --class-path "target/libs/*" target/classes
It lists the jakarta.json.bind
modules, and shows it resolved (white space elided):
my.project -> jakarta.json.bind jakarta.json.bind-api-2.0.0.jar
In fact, it has no complaints whatsoever. I even added -R
to make it recursive, and it does not mention any missing modules.
I said "Oh, I should be using module-path instead of class-path":
jdeps --multi-release 17 --module-path "target/libs/*" target/classes
Same problem. It's complaining about different modules (I've seen it complain about javafx.graphics
and javafx.media
). But the problem is the same. The same exception is thrown.
I find it odd that jdeps
chooses to thrown an exception, rather than just print out that the module is missing.
So, in summary, I have a working modular project. It builds, it executes fine. jdeps
gives me these exceptions in the use cases above, but when I remove my module-info.class
file, the jdeps
gives me all sorts of useful information. Just not when my project is a module.
Why does jdeps
not work on my module project?