在Maven中,要将properties文件打包到同目录下的JAR中,可以通过配置build标签下的resources来实现。以下是一个简单的配置示例
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</build>
如果要变更打包后的位置,可以使用targetPath标签
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<targetPath>com/gzhryc/</targetPath>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>