JPMS是否支持模块版本? [英] Does JPMS support module version?
问题描述
我认为JPMS不支持模块版本.但是,当我执行java --list-modules
时,会有以下输出:
I thought that JPMS doesn't support module version. However, when I do java --list-modules
I have the following output:
java.activation@9
java.base@9
java.compiler@9
java.corba@9
java.datatransfer@9
java.desktop@9
java.instrument@9
....
所以,我不明白这个@9
是什么.是这个版本还是什么?如果JPMS支持模块版本,是否可以在模块A的module-info中设置,该模块A需要特定版本的模块B?
So, I can't understand what this @9
is. Is this version or what? If JPMS supports module version, can I set in module-info of module A, that module A requires module B of certain version?
推荐答案
我不明白这是@ 9是什么.是这个版本还是什么?
I can't understand what this @9 is. Is this version or what?
是的,它是模块的版本.
Yes, it is the version of the module.
如果JPMS支持模块版本,我可以在模块A的module-info中进行设置, 该模块A需要特定版本的模块B?
If JPMS supports module version, can I set in module-info of module A, that module A requires module B of certain version?
否,您不能在另一个模块的声明中引用模块的特定版本.我相信模块系统的状态#Module总是清楚地提到了这一点.声明
No, you cannot refer a specific version of a module in another module's declaration. I believe this was always clearly mentioned in The State of the Module System#Module Declarations
模块的声明不包含版本字符串,也不包含对其依赖的模块的版本字符串的约束.这是有意的,因为这不是解决版本选择问题,最好将其用于构建工具和容器应用程序.
A module’s declaration does not include a version string, nor constraints upon the version strings of the modules upon which it depends. This is intentional as it is not a goal of the module system to solve the version-selection problem, which is best left to build tools and container applications.
这篇关于JPMS是否支持模块版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!