I`m trying to run jdeps with the following command:
jdeps --module-path modules --generate-module-info out com.demo.market.jar
My com.demo.market.jar
depends both on application modules and automatic modules.
I put all dependencies in the 'modules' folder but I got an error:
Error: missing dependencies
com.demo.market.platform.MarketPlace -> com.demo.client.wholesale.Client not found
com.demo.market.platform.MarketPlace -> com.demo.product.api.Product not found
com.demo.market.platform.MarketPlace -> com.demo.product.laptop.Laptop not found
com.demo.market.collector.ProductsCollector -> com.demo.logistic.DeliveryService not found
com.demo.market.collector.ProductsCollector -> com.demo.product.api.Product not found
But when I add --add-modules
It works fine.
jdeps --module-path modules --add-modules com.demo.client,com.demo.product,com.demo.logistic --generate-module-info out com.demo.market.jar
Am I doing something wrong? I supposed that jdeps would find all modules instead of manually add them.
When you execute the following:
jdeps --module-path modules --generate-module-info out com.demo.market.jar
The modules that are resolved from the directory are observable modules which in your case are not able to make it to the set of root modules.
Over the other part of the question -
jdeps --module-path modules --add-modules com.demo.client,com.demo.product,com.demo.logistic --generate-module-info . com.demo.market.jar
While on the other hand, adding them explicitly makes sure the modules are present in the set of root modules.
As an alternative(from the JEP261#Module System, you can try using the command
jdeps --module-path modules --add-modules=ALL-MODULE-PATH --generate-module-info out com.demo.market.jar
As a final special case, at both run time and link time, if is ALL-MODULE-PATH then all observable modules found on the relevant module paths are added to the root set. ALL-MODULE-PATH is valid at both compile time and run time. This is provided for use by build tools such as Maven, which already ensure that all modules on the module path are needed. It is also a convenient means to add automatic modules to the root set.
Side note there, in terms of the commands to be executed:-
jdeps
output shared in the question holds true with -verbose:class
ideally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With