Maven中的profile和spring boot中的profile进行结合

有一些应用,采用了spring boot和spring boot profile。然后想把maven 中的profile和spring boot中的profile 进行一个集成。比如我在idea中修改mvn的profile,就可以修改整个项目的spring boot中的profile。

<profiles>
    <!-- 默认激活 dev 开发环境 -->
    <!-- 线上使用 mvn 打包添加 -Pproduction 变量 -->
    <profile>
        <!-- 本地开发环境 -->
        <id>development</id>
        <properties>
            <profiles.active>development</profiles.active>
            <properties.version>2.0-SNAPSHOT</properties.version>
        </properties>

    </profile>
    <profile>
        <!-- 本地开发环境 -->
        <id>test</id>
        <properties>
            <profiles.active>test</profiles.active>
            <properties.version>test-SNAPSHOT</properties.version>
        </properties>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>

    </profile>
    <profile>
        <!-- 生产环境 -->
        <id>production</id>
        <properties>
            <profiles.active>production</profiles.active>
            <properties.version>production-SNAPSHOT</properties.version>
        </properties>
    </profile>
</profiles>

Spring boot 使用profile完成不同环境的maven打包功能

springboot maven 多环境配置

Spring Boot Profile 与Maven Profile 集成实践

[Spring Boot 系列] 集成maven和Spring boot的profile功能

猜你喜欢

转载自my.oschina.net/miaojiangmin/blog/1825090