修改package.xml。。。插件打包的时候改成 编译后的目录,此时环境变量已经替换为值。
<fileSet>
<directory>${project.build.directory}/classes</directory>
<includes>
<include>sql</include>
<include>*.properties</include>
<include>*.xml</include>
<include>*.txt</include>
</includes>
<outputDirectory>config</outputDirectory>
</fileSet>
修改maven pom
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>config.properties</exclude>
<exclude>undertow.txt</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>config.properties</include>
<include>undertow.txt</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
多环境配置 请自行查看资料
<!-- 多环境配置 -->
<profiles>
<!-- 测试 -->
<profile>
<id>dev8880</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- config.properties start -->
<jdbc.user>root</jdbc.user>
<jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
</properties>
</profile>
</profiles>
感谢分享