maven 不同环境加载不同的properties 文件

http://haohaoxuexi.iteye.com/blog/1900568 //参考文章

实际项目中pom配置如下

<profiles>
<profile>
<id>dev</id>
<properties>
<profile.environment>dev</profile.environment>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>online</id>
<properties>
<profile.environment>online</profile.environment>
</properties>
</profile>
</profiles>

maven 构建项目的参数如下

clean jetty:run -Pdev   //-P指定读取的文件,为测试环境

clean jetty:run -Ponline   //-P读取online 下的文件,正式的部署环境

原文地址:https://www.cnblogs.com/lilefordream/p/5006743.html