有没有办法在单个Maven项目中编译多个Java源目录?
你可以使用build-helper添加新的源目录:
<build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>src/main/generated</source> </sources> </configuration> </execution> </executions> </plugin> </plugins> </build>