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

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

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

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>
            <!-- 默認環(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 文件中,修改了打包配置,只會打包進指定環(huán)境的配置文件,所以在啟動時不用再指定環(huán)境參數(shù)了

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

相關文章

最新評論

友谊县| 永福县| 兴宁市| 获嘉县| 镇赉县| 呼图壁县| 梨树县| 长白| 余干县| 镇原县| 沛县| 泾阳县| 竹山县| 东宁县| 班戈县| 塘沽区| 台山市| 轮台县| 利辛县| 桐梓县| 饶河县| 辉县市| 郴州市| 河北区| 右玉县| 阿尔山市| 弋阳县| 灵川县| 揭阳市| 蓬安县| 昌吉市| 宁陕县| 措美县| 曲松县| 武隆县| 惠水县| 炎陵县| 贵港市| 金门县| 江都市| 明水县|