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

maven打包時(shí)候修改包名稱帶上git版本號和打包時(shí)間方式

 更新時(shí)間:2023年04月06日 15:18:16   作者:請叫我大師兄_  
這篇文章主要介紹了maven打包時(shí)候修改包名稱帶上git版本號和打包時(shí)間方式,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

maven打包時(shí)候修改包名稱帶上git版本號和打包時(shí)間

使用 maven 插件 git-commit-id-plugin 可以獲取項(xiàng)目的git信息,然后,使用這個(gè)信息,修改打包的名稱,使其帶上git版本號以及打包時(shí)間。

	<build>
        <finalName>${artifactId}-${git.commit.id.abbrev}-${git.build.time}</finalName>
        <plugins>
            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>2.1.5</version>
                <executions>
                    <execution>
                        <id>get-the-git-infos</id>
                        <!-- 默認(rèn)綁定階段initialize -->
                        <phase>initialize</phase>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!--日期格式;默認(rèn)值:dd.MM.yyyy '@' HH:mm:ss z;-->
                    <dateFormat>yyyy-MM-dd_HH-mm-ss</dateFormat>
                    <!--,構(gòu)建過程中,是否打印詳細(xì)信息;默認(rèn)值:false;-->
                    <verbose>true</verbose>
                    <!-- ".git"文件路徑;默認(rèn)值:${project.basedir}/.git; ${project.basedir}:項(xiàng)目根目錄,即包含pom.xml文件的目錄-->
                    <dotGitDirectory>${project.basedir}/../../../.git</dotGitDirectory>
                    <!--若項(xiàng)目打包類型為pom,是否取消構(gòu)建;默認(rèn)值:true;-->
                    <skipPoms>false</skipPoms>
                    <!--是否生成"git.properties"文件;默認(rèn)值:false;-->
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
                    <!--指定"git.properties"文件的存放路徑(相對于${project.basedir}的一個(gè)路徑);-->
                    <generateGitPropertiesFilename>/src/main/resources/git.properties</generateGitPropertiesFilename>
                    <!--".git"文件夾未找到時(shí),構(gòu)建是否失敗;若設(shè)置true,則構(gòu)建失敗;若設(shè)置false,則跳過執(zhí)行該目標(biāo);默認(rèn)值:true;-->
                    <failOnNoGitDirectory>true</failOnNoGitDirectory>
 
                    <!--git描述配置,可選;由JGit提供實(shí)現(xiàn);-->
                    <gitDescribe>
                        <!--是否生成描述屬性-->
                        <skip>false</skip>
                        <!--提交操作未發(fā)現(xiàn)tag時(shí),僅打印提交操作ID,-->
                        <always>false</always>
                        <!--提交操作ID顯式字符長度,最大值為:40;默認(rèn)值:7; 0代表特殊意義;后面有解釋;-->
                        <abbrev>7</abbrev>
                        <!--構(gòu)建觸發(fā)時(shí),代碼有修改時(shí)(即"dirty state"),添加指定后綴;默認(rèn)值:"";-->
                        <dirty>-dirty</dirty>
                        <!--always print using the "tag-commits_from_tag-g_commit_id-maybe_dirty" format, even if "on" a tag.
                            The distance will always be 0 if you're "on" the tag.  -->
                        <forceLongFormat>false</forceLongFormat>
                    </gitDescribe>
                </configuration>
            </plugin>
        </plugins>
    </build>

實(shí)際運(yùn)行結(jié)果:

git.properties文件內(nèi)容

#Generated by Git-Commit-Id-Plugin
#Fri Nov 12 15:06:14 CST 2021
git.commit.id.abbrev=ff60f80
git.commit.user.email=xxx@163.com
git.commit.message.full=git提交說明
git.commit.id=ff60f8091627e53891fc15bdccad93115f8623c9
git.commit.message.short=簡要說明
git.commit.user.name=abc
git.build.user.name=efg
git.commit.id.describe=xxxx
git.build.user.email=xxx@163.com
git.branch=xxx-dev
git.commit.time=2011-11-09_14-00-40
git.build.time=2011-11-12_15-06-14
git.remote.origin.url=http\://1.1.1.1\:1/group/xxx.git

maven打包日??偨Y(jié)

1、 將第三方依賴性jar包中的文件打包入jar中,打包時(shí)修改引入jar包的包名,防止包沖突

?<!--將第三方依賴性jar包中的文件打包入jar中-->
? ? ? ? ? ? <plugin>
? ? ? ? ? ? ? ? <groupId>org.apache.maven.plugins</groupId>
? ? ? ? ? ? ? ? <artifactId>maven-shade-plugin</artifactId>
? ? ? ? ? ? ? ? <!-- 打包失敗可能是版本太低,提高版本 -->
? ? ? ? ? ? ? ? <version>3.1.0</version>
? ? ? ? ? ? ? ? <executions>
? ? ? ? ? ? ? ? ? ? <execution>
? ? ? ? ? ? ? ? ? ? ? ? <phase>package</phase>
? ? ? ? ? ? ? ? ? ? ? ? <goals>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <goal>shade</goal>
? ? ? ? ? ? ? ? ? ? ? ? </goals>
? ? ? ? ? ? ? ? ? ? ? ? <configuration>
? ? ? ? ? ? ? ? ? ? ? ? ? ? <!-- 打包時(shí)修改引入jar包的包名,防止包沖突 -->
? ? ? ? ? ? ? ? ? ? ? ? ? ? <relocations>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <relocation>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <pattern>org.apache.http</pattern>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <shadedPattern>shaded.org.apache.http</shadedPattern>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <!--<excludes>-->
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <!--<exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>-->
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <!--<exclude>org.codehaus.plexus.util.xml.pull.*</exclude>-->
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <!--</excludes>-->
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? </relocation>
? ? ? ? ? ? ? ? ? ? ? ? ? ? </relocations>
?
? ? ? ? ? ? ? ? ? ? ? ? ? ? <filters>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <filter>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <artifact>*:*</artifact>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <excludes>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <exclude>META-INF/*.SF</exclude>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <exclude>META-INF/*.DSA</exclude>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <exclude>META-INF/*.RSA</exclude>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? </excludes>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? </filter>
? ? ? ? ? ? ? ? ? ? ? ? ? ? </filters>
? ? ? ? ? ? ? ? ? ? ? ? </configuration>
? ? ? ? ? ? ? ? ? ? </execution>
? ? ? ? ? ? ? ? </executions>
? ? ? ? ? ? </plugin>

2、阻止第三方j(luò)ar包被打入執(zhí)行包

? ? ? ? <dependency>
? ? ? ? ? ? <groupId>org.apache.hadoop</groupId>
? ? ? ? ? ? <artifactId>hadoop-client</artifactId>
? ? ? ? ? ? <version>2.7.2</version>
? ? ? ? ? ? <!-- 阻止第三方j(luò)ar包被打入執(zhí)行包 -->
? ? ? ? ? ? <scope>provided</scope>
? ? ? ? </dependency>

3、打包時(shí)不包含該包下的部分子包

? ? ? ?<dependency>
? ? ? ? ? ? <groupId>org.elasticsearch.client</groupId>
? ? ? ? ? ? <artifactId>elasticsearch-rest-high-level-client</artifactId>
? ? ? ? ? ? <version>6.3.2</version>
? ? ? ? ? ? <!-- 不包含org.apache.httpcomponents包 -->
? ? ? ? ? ? <exclusions>
? ? ? ? ? ? ? ? <exclusion>
? ? ? ? ? ? ? ? <groupId>org.apache.httpcomponents</groupId>
? ? ? ? ? ? ? ? <artifactId>httpcore</artifactId>
? ? ? ? ? ? ? ? </exclusion>
? ? ? ? ? ? </exclusions>
? ? ? ? </dependency>

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Java常用注解擴(kuò)展對比舉例詳解

    Java常用注解擴(kuò)展對比舉例詳解

    這篇文章主要介紹了Java常用注解擴(kuò)展對比的相關(guān)資料,提供了豐富的代碼示例,并總結(jié)了最佳實(shí)踐建議,幫助開發(fā)者更好地理解和應(yīng)用這些注解,需要的朋友可以參考下
    2025-03-03
  • Java 泛型(Generic)簡介及用法詳解

    Java 泛型(Generic)簡介及用法詳解

    泛型是一種把類型明確的工作推遲到創(chuàng)建對象或者調(diào)用方法的時(shí)候才去明確的特殊的類型,參數(shù)化類型,把類型當(dāng)作參數(shù)一樣的傳遞,本文給大家介紹Java 泛型(Generic)概述及使用,感興趣的朋友跟隨小編一起看看吧
    2023-10-10
  • Spring讀取配置文件屬性實(shí)現(xiàn)方法

    Spring讀取配置文件屬性實(shí)現(xiàn)方法

    這篇文章主要介紹了Spring讀取配置文件屬性實(shí)現(xiàn)方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-04-04
  • Netty的心跳檢測解析

    Netty的心跳檢測解析

    這篇文章主要介紹了Netty的心跳檢測解析,客戶端的心跳檢測對于任何長連接的應(yīng)用來說,都是一個(gè)非?;A(chǔ)的功能,要理解心跳的重要性,首先需要從網(wǎng)絡(luò)連接假死的現(xiàn)象說起,需要的朋友可以參考下
    2023-12-12
  • postman中POST請求時(shí)參數(shù)包含參數(shù)list設(shè)置方式

    postman中POST請求時(shí)參數(shù)包含參數(shù)list設(shè)置方式

    這篇文章主要介紹了postman中POST請求時(shí)參數(shù)包含參數(shù)list設(shè)置方式,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-05-05
  • Java 開啟多線程常見的4種方法

    Java 開啟多線程常見的4種方法

    本文主要介紹了Java 開啟多線程常見的4種方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-06-06
  • jackson使用@JsonSerialize格式化BigDecimal解決.00不顯示問題

    jackson使用@JsonSerialize格式化BigDecimal解決.00不顯示問題

    這篇文章主要介紹了jackson使用@JsonSerialize格式化BigDecimal解決.00不顯示問題,本文直接給出實(shí)現(xiàn)代碼,需要的朋友可以參考下
    2015-02-02
  • Java8方法引用和構(gòu)造引用代碼實(shí)例

    Java8方法引用和構(gòu)造引用代碼實(shí)例

    這篇文章主要介紹了java8方法引用和構(gòu)造引用代碼實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-12-12
  • java簡單自定義異常實(shí)例代碼

    java簡單自定義異常實(shí)例代碼

    這篇文章主要為大家詳細(xì)介紹了java簡單自定義異常實(shí)例代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-11-11
  • rabbitmq延遲隊(duì)列的使用方式

    rabbitmq延遲隊(duì)列的使用方式

    這篇文章主要介紹了rabbitmq延遲隊(duì)列的使用方式,使用rabbitmq的延時(shí)隊(duì)列插件,實(shí)現(xiàn)同一個(gè)隊(duì)列中有多個(gè)不同超時(shí)時(shí)間的消息,并按時(shí)間超時(shí)順序出隊(duì),本文給大家介紹的非常詳細(xì),需要的朋友參考下吧
    2024-04-04

最新評論

敦化市| 赤水市| 诏安县| 云南省| 兴隆县| 抚顺县| 开原市| 万源市| 阜平县| 嘉善县| 贵德县| 库车县| 浦城县| 饶河县| 平邑县| 遵义市| 鄄城县| 洱源县| 阳城县| 湄潭县| 定州市| 商水县| 金坛市| 淮北市| 新郑市| 望谟县| 通山县| 章丘市| 寿光市| 沅陵县| 郓城县| 佳木斯市| 揭阳市| 龙江县| 高青县| 河北区| 陇西县| 印江| 岳普湖县| 五指山市| 大田县|