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
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
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.