如何为 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>3.2.0</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屋!
查看全文