Java 9子软件包跨模块拆分 [英] Java 9 sub-packages split across modules
问题描述
在Java 9中,我可以在模块之间拆分子包吗?例如,我可以在一个模块中包含com.example.foo
,而在另一个模块中包含com.example.foo.bar
吗?
In Java 9, can I split sub-packages across modules? For example, can I have com.example.foo
in one module and com.example.foo.bar
in another module?
这似乎是一个简单的问题,但由于某些原因,经过一些搜索后,我无法找到直接答案.权威的参考文献将不胜感激.
This seems like a simple question, but for some reason I'm not able to find a direct answer after some searching. An authoritative reference would be appreciated.
我假设我可以在不同的模块中拥有同级子包,例如com.example.foo
和com.example.other
.
I assume I can have sibling sub-packages in different modules, e.g. com.example.foo
and com.example.other
.
推荐答案
没有子包"之类的东西. my.package
和my.package.sub
的共同点仅在于任意两个随机程序包:它们只是具有相似的名称.请参见此答案(以
There's no such thing as a "sub-package". my.package
and my.package.sub
have nothing more in common than any two random packages: they just have similar names. See this answer which starts
实际上,没有Java子包之类的东西
In reality there is no such thing as a sub-package in Java
是的,是的,您可以将它们包含在不同的模块中.
That being the case, yes you can include them in different modules.
这篇关于Java 9子软件包跨模块拆分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!