当前位置:   article > 正文

idea 中的 profiles 详解_idea profiles设置

idea profiles设置

在这里插入图片描述
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>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

与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@

  • 1
  • 2
  • 3
  • 4
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/995805
推荐阅读
相关标签
  

闽ICP备14008679号