在最近的 Maven 版本(3)和最新版本的 Maven 编译器插件(3.7.0)中,我注意到,如果包含要添加到构建中的源代码的文件夹位于 target文件夹或其子文件夹中,则不需要添加带有 build-helper-maven-plugin的源文件夹。
It seems that the compiler maven plugin compiles any java source code located inside this folder whatever the directory that contains them.
例如,在 target/a中有一些(生成或没有)源代码,target/generated-source/foo将被编译并添加到 outputDirectory: target/classes中。