Maven使用多个src目录编译 [英] Maven compile with multiple src directories
本文介绍了Maven使用多个src目录编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在单个maven项目中编译多个java源目录?
解决方案
您可以使用build-helper添加新的源目录:
< pre class =lang-xml prettyprint-override>
< 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>
Is there a way to compile multiple java source directories in a single maven project?
解决方案
You can add a new source directory with 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>
这篇关于Maven使用多个src目录编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文