Missing dependencies when generate-module-info jdeps

℡╲_俬逩灬. 提交于 2019-12-17 20:17:35

问题


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.


回答1:


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:-

  • Also, the jdeps output shared in the question holds true with -verbose:class ideally.


来源:https://stackoverflow.com/questions/47500529/missing-dependencies-when-generate-module-info-jdeps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!