如何为maven添加额外的源目录以进行编译并包含在构建jar中? [英] How to add an extra source directory for maven to compile and include in the build jar?
本文介绍了如何为maven添加额外的源目录以进行编译并包含在构建jar中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
除了src / main / java之外,我正在添加一个src / bootstrap目录,我希望在我的构建过程中包含该目录,换句话说,我希望maven在我的构建中编译并包含源代码。怎么样??
In addition to the src/main/java, I am adding a src/bootstrap directory that I want to include in my build process, in other words, I want maven to compile and include the sources there in my build. How!?
推荐答案
你可以使用构建助手插件,例如:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>some directory</source>
...
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
这篇关于如何为maven添加额外的源目录以进行编译并包含在构建jar中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文