生成模块信息jdeps时缺少依赖项 [英] Missing dependencies when generate-module-info jdeps
问题描述
我试图使用以下命令运行jdeps:
I`m trying to run jdeps with the following command:
jdeps --module-path modules --generate-module-info out com.demo.market.jar
我的 com.demo .market.jar
取决于应用程序模块和自动模块。
我将所有依赖项放在'modules'文件夹中但是我收到了一个错误:
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
但是当我添加 --add-modules
它工作正常。
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
我在做什么有问题?我认为jdeps会找到所有模块而不是手动添加它们。
Am I doing something wrong? I supposed that jdeps would find all modules instead of manually add them.
推荐答案
执行以下操作时:
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.
作为替代方案(来自 JEP261#Module System ,您可以尝试使用命令
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
作为最后的特例,两次运行时间和链接时间,如果是 ALL-MODULE-PATH ,那么在相关的
模块路径上找到的所有可观察模块都会被添加到根集中。 ALL-MODULE-PATH 在
的编译时和运行时都有效。这是为了让
工具(如Maven)使用,它已经确保了
模块路径上的所有模块都是必需的。也是一个骗局venient意味着将自动
模块添加到根集。
请注意,根据要执行的命令: -
Side note there, in terms of the commands to be executed:-
- 此外,
jdeps
在理想情况下,问题中共享的输出与-verbose:class
一致。
- Also, the
jdeps
output shared in the question holds true with-verbose:class
ideally.
这篇关于生成模块信息jdeps时缺少依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!