Following up on How to define qualified exports to unknown modules? I\'ve posted a testcase with two modules: core
and plugin
.
core
I figured it out through trial and error.
--module-source-path ${project.basedir}/../*/src/main/java
to make sure the compiler can see the source-code of both modules.--module core
to make sure that the compiler only builds core
in spite of seeing all modules.maven-jar-plugin
to package classes from classes/${module.name}
instead of just classes
because module-source-path
causes the output to be prefixed by the module name. I have not found a way to disable this prefix.The fixed code can be found at https://bitbucket.org/cowwoc/qualified-exports-testcase/
Caveat: This technique only works if the module directory name (the component resolved by *
) matches the Java module name. In this particular example the module core
had its sources in directory core/src/main/java
. If, on the other hand, the directory name was core
but the corresponding Java module was org.bitbucket.core
then the compilation would fail with module org.bitbucket.core not found in module source path
.