pom.xml文件配置
在bulid中指定resources路径并指定不加载的配置文件
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<!-- <exclude>*.xml</exclude>
<exclude>*.ini</exclude>
<exclude>log4j.properties</exclude> -->
<exclude>application-prod.properties</exclude>
</excludes>
</resource>
</resources>
在指定启动类处指定要加载的配置文件路径
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.tst.cnosc.App</mainClass>
<manifestEntries>
<Class-Path>config/.</Class-Path>
</manifestEntries>
</transformer>
打包后在包路径新建指定的路径文件夹,并将配置文件放入文件夹中
标签:xml,配置文件,路径,指定,maven,打包,加载 From: https://www.cnblogs.com/chenlei53/p/17278959.html