springboot maven 配置多环境部署
2017-02-05 17:12
495 查看
1、springboot项目中配置application.properties内容
spring.profiles.active=@profileActive@
2、创建不同环境下的配置文件
application-dev.properties、application-prod.properties、application-test.properties
3、pom文件中配置profiles节点
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<profileActive>dev</profileActive>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<profileActive>test</profileActive>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<profileActive>prod</profileActive>
</properties>
</profile>
</profiles>
4、通过maven打包命令即可打出不同环境下的程序包
打生产环境包
mvn clean package -P prod -U
打测试环境包
mvn clean package -P test -U
打开发环境包
mvn clean package -P dev -U
spring.profiles.active=@profileActive@
2、创建不同环境下的配置文件
application-dev.properties、application-prod.properties、application-test.properties
3、pom文件中配置profiles节点
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<profileActive>dev</profileActive>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<profileActive>test</profileActive>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<profileActive>prod</profileActive>
</properties>
</profile>
</profiles>
4、通过maven打包命令即可打出不同环境下的程序包
打生产环境包
mvn clean package -P prod -U
打测试环境包
mvn clean package -P test -U
打开发环境包
mvn clean package -P dev -U
相关文章推荐
- Spring Boot 使用 Druid 和监控配置
- 添加Maven(mvn)、sbt的国内仓库
- maven学习
- maven插件maven-war-plugin的使用
- jenkins------部署项目到jboss eap下
- maven 无法下载私服nexus的jar包
- maven使用经验集
- 调用maven命令的BAT脚本分享
- Maven的几个常用plugin
- 解决maven update project 后项目jdk变成1.5的问题
- spring-boot使用AOP统一处理日志
- Maven pom.xml与settings.xml详解
- 详解Spring Boot Junit单元测试
- eclipse maven maven-archetype-webapp 创建失败问题解决
- 详解Spring Boot 集成Shiro和CAS
- MyEclipse8.6首次运行maven项目图标上没有小M的标识怎么解决
- java application maven项目打自定义zip包实例(推荐)
- git拉源码maven构建后部署脚本详解
- Maven安装及MyEclipse中使用Maven