赞
踩
profile 主要是为了解决不同环境所需的不同变量、配置等问题.
profile 一般出现在两个地方:settings.xml,pom.xml
在 settings.xml 时,一般用来做仓库的选择(只使用 aliyun 仓库可以这样配置 settings.xml)
在 pom.xml 时,一般用来激活环境配置
<profiles> <profile> <id>local</id> <properties> <profiles.active>local</profiles.active> </properties> </profile> <profile> <id>elk</id> <properties> <profiles.active>elk</profiles.active> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> </profiles>
与profile打包时搭配使用的build 代码如下配置(结合application-${env}.properties文件使用)
application-${env}.properties 中的部分内容
application-prepub.properties 中 spring.profiles.active=prepub-qa
application-daily.properties 中 spring.profiles.active=daily
application.properties 中 spring.profiles.active=@env@
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。