最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

maven打包時配置多環(huán)境參數(shù)的實現(xiàn)

 更新時間:2025年04月27日 09:13:40   作者:Lt0_  
本文主要介紹了maven打包時配置多環(huán)境參數(shù)的實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

1. pom配置

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    
    <!-- 其他配置 -->

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <!-- 只打包指定環(huán)境的配置文件 -->
                <includes>
                    <include>application-${profile.active}.properties</include>
                    <include>application.properties</include>
                </includes>
                <!-- 啟用過濾 即該資源中的變量將會被過濾器中的值替換 -->
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <profiles>
        <profile>
            <id>dev</id>
            <properties>
                <profile.active>dev</profile.active>
            </properties>
            <!-- 默認(rèn)環(huán)境 -->
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>long</id>
            <properties>
                <profile.active>long</profile.active>
            </properties>
        </profile>
        <profile>
            <id>sit</id>
            <properties>
                <profile.active>sit</profile.active>
            </properties>
        </profile>
    </profiles>

</project>

2. application配置

spring:
  profiles:
    active: @profile.active@

此處的 profile.active 與 上述 pom.xml 配置文件中的 properties 屬性一致

3. 打包

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

-Plong:指定打包的環(huán)境為 long

4. 注意

因為在 pom 文件中,修改了打包配置,只會打包進(jìn)指定環(huán)境的配置文件,所以在啟動時不用再指定環(huán)境參數(shù)了

到此這篇關(guān)于maven打包時配置多環(huán)境參數(shù)的實現(xiàn)的文章就介紹到這了,更多相關(guān)maven打包時配置多環(huán)境參數(shù)內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

绥德县| 广宗县| 延长县| 清流县| 南开区| 柳河县| 长顺县| 怀化市| 诏安县| 敦化市| 临邑县| 应城市| 河东区| 乃东县| 手游| 高青县| 龙川县| 阜宁县| 高碑店市| 漳平市| 鸡东县| 闻喜县| 如皋市| 高雄市| 乌鲁木齐县| 丹阳市| 西吉县| 瑞丽市| 察雅县| 贵港市| 长垣县| 阿城市| 叙永县| 全南县| 同仁县| 永嘉县| 汨罗市| 宣武区| 英山县| 康马县| 大英县|