I have a Maven project with two Maven modules A
and B
. A
contains the following Java module definition:
module A {
exports internal.util to B;
exports external.A;
}
B
contains the following Java module definition:
module B {
requires A;
exports external.B;
}
When I build the project, I get an error:
[WARNING] module-info.java:[16,106] module not found: B
Module B
exists but because Module A
is compiled before B
and does not depend on it, the compiler has no way of knowing that. Because I configured the compiler to treat warnings as errors (-Werror
), the build fails.
Seeing as I want to keep treating warnings as errors, what is the best way to resolve this problem?
I figured out a workaround by scanning through the JDK 11 source-code: -Xlint:-module
. I am still open to a better solution if someone finds one.
UPDATE: An alternative is to use --module-source-path
as demonstrated by https://stackoverflow.com/a/53717183/14731
Thank you Alan Bateman for pointing me in this direction!