Java 9子软件包跨模块拆分 [英] Java 9 sub-packages split across modules

查看:56
本文介绍了Java 9子软件包跨模块拆分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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.foocom.example.other.

I assume I can have sibling sub-packages in different modules, e.g. com.example.foo and com.example.other.

推荐答案

没有子包"之类的东西. my.packagemy.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆