简体   繁体   English

Java 9子软件包跨模块拆分

[英]Java 9 sub-packages split across modules

In Java 9, can I split sub-packages across modules? 在Java 9中,我可以在模块之间拆分子包吗? For example, can I have com.example.foo in one module and com.example.foo.bar in another module? 例如,可我已经com.example.foo一个模块和com.example.foo.bar另一个模块?

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. 权威参考将不胜感激。

I assume I can have sibling sub-packages in different modules, eg com.example.foo and com.example.other . 我假设我可以在不同的模块中拥有同级子包,例如com.example.foocom.example.other

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. my.packagemy.package.sub仅在于任意两个随机软件包:它们具有相似的名称。 See this answer which starts 看到这个答案开始

In reality there is no such thing as a sub-package in Java 实际上,Java中没有子包之类的东西

That being the case, yes you can include them in different modules. 既然如此,是的,您可以将它们包含在不同的模块中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM