在maven中如何在输出jar中的同一位置包含非java src文件? [英] In maven how can I include non-java src files in the same place in the output jar?
本文介绍了在maven中如何在输出jar中的同一位置包含非java src文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到了一个源代码包。在src目录树里面有一些属性文件(.properties),我想把它们保存在同一个地方的输出jar中。例如:我想要
I received a source code bundle. Inside the src directory tree there are some properties files(.properties) which I want to keep in the output jar in the same place. e.g: I want
src/main/java/com.mycompany/utils/Myclass.java
src/main/java/com.mycompany/utils/Myclass.properties
在jar中保持不变:
com.mycompany/utils/Myclass.class
com.mycompany/utils/Myclass.properties
无需将属性文件添加到单独的资源文件夹中。有没有办法告诉maven?
without needing to add the properties file it to separate resources folder. Is there a way to I tell this to maven?
推荐答案
您可以在pom中添加以下内容,表明资源可用在 src / main / java
和包括
资源类型。
You could add the following in your pom indicating that the resources are available in src/main/java
and including
the type of resources.
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</build>
这篇关于在maven中如何在输出jar中的同一位置包含非java src文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文