application.yml 配合 pom.xml

spring:
profiles:
active: @spring.profiles.active@

pom.xml 文件

src/main/resourcestrueorg.apache.maven.pluginsmaven-resources-plugin2.7@falseprodprodtruedevdev
    </profile>
    <profile>
        <!-- 测试环境 -->
        <id>test</id>
        <properties>
            <spring.profiles.active>test</spring.profiles.active>
        </properties>
    </profile>
</profiles>

分环境打包
mvn clean package -Pprod -Dmaven.test.skip=true

mvn clean package -Pdev -Dmaven.test.skip=true

相关文章:

  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2021-08-20
  • 2021-09-07
  • 2022-12-23
  • 2021-05-21
  • 2021-08-28
猜你喜欢
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2021-07-17
  • 2021-08-09
  • 2021-11-16
相关资源
相似解决方案