快速开启maven多环境配置

快速开启maven多环境配置

<profiles>
<profile>
<id>local</id>
<properties>

<profiles>
<profile>
<id>local</id>
<properties>
<env>local</env><!-- env可以自定义 -->
</properties>
<activation>
<activeByDefault>true</activeByDefault><!-- 默认开启 -->
</activation>
</profile>
<profile>
<id>prod</id>
<properties>
<env>prod</env>
</properties>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>jdbc/**</exclude><!-- 排除所有jdbc的配置 -->
</excludes>
</resource>
<resource>
<directory>src/main/resources/jdbc/${env}</directory><!-- 添加启用的环境配置的路径 -->
</resource>
</resources>
</build>

mvn install -Pprod启用prod的环境

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×