in src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java [1034:1048]
boolean hasModuleDeclaration(final List<SourceDirectory> roots) throws IOException {
switch (project.getPackaging().type().id()) {
case Type.CLASSPATH_JAR:
return false;
case Type.MODULAR_JAR:
return true;
default:
for (SourceDirectory root : roots) {
if (root.getModuleInfo().isPresent()) {
return true;
}
}
return false;
}
}