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

flatten-maven-plugin使用教程

 更新時間:2023年07月13日 14:44:26   作者:2021不再有雨  
這篇文章主要介紹了flatten-maven-plugin使用,本文通過示例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下

一、簡介

1.1 作用

將pom工程父子pom的版本,提出作為變量定義在properties。

這樣僅修改變量的值(如在運行mvn命令時指定) 即可實現(xiàn)版本整體切換。

1.2 goal介紹

  • flatten:clean

刪除flatten插件生成的 .flattened-pom.xml

配置參數(shù)有:

flattenedPomFilename: 插件生成的pom的名字,默認為 .flattened-pom.xml

outputDirectory:插件生成pom的目錄,默認為 ${project.basedir}

  • flatten:flatten

resources-process生成 .flattened-pom.xml,并在install/deploy時替換原始pom.xml

主要配置參數(shù)有:

flattenedPomFilename: 插件生成的pom的名字,默認為 .flattened-pom.xml

outputDirectory:插件生成pom的目錄,默認為 ${project.basedir}

updatePomFile: packing=pom的module也進行reversion變量替換,默認為false

flattenMode:用來定義生成 .flattened-pom.xml所包含的元素,常用值有:

oss:開源軟件常用,除了repositories/pluginRepositories外其他所有FlattenDescriptor定義的元素都生成

ossrh:所有FlattenDescriptor定義的元素都生成

bom:在ossrh基礎上增加dependencyManagement和properties

defaults:除了repositories其他所有FlattenDescriptor定義的元素都不生成

clean:所有FlattenDescriptor定義的元素都不生成

fatjar:所有FlattenDescriptor定義的元素和dependencies都不生成

resolveCiFriendliesOnly:只替換原始pom中的revision, sha1 and changelist,其他否保持原樣

常用oss/ossrh/resolveCiFriendliesOnly

  • FlattenDescriptor定義的pom.xml元素有:

modelVersion
groupId
artifactId
version
packaging
licenses
dependencies
profiles
name
description
url
inceptionYear
organization
scm
developers
contributors
mailingLists
pluginRepositories
issueManagement
ciManagement
distributionManagement
prerequisites
repositories
parent
build
dependencyManagement
properties
modules
reporting

二、使用總結

  • 不用flatten-maven-plugin

1.父pom定義版本為變量reversion并作為version,子pom復引用變量reversion作為version

2.結果能正常運行compile/test, 但install或deploy時父子pom中的version還是reversion變量未被替換

3.沒有version別人無法引用你的包

父pom.xml

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <version>${reversion1}</version>
    <modules>
        <module>no-flatten-child</module>
    </modules>
    <groupId>com.wsl.my.maven</groupId>
    <artifactId>no-flatten-plugin</artifactId>
    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <reversion1>1.1.0-SNAPSHOT</reversion1>
    </properties>
</project>

子pom.xml

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>no-flatten-plugin</artifactId>
        <groupId>com.wsl.my.maven</groupId>
        <version>${reversion1}</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>no-flatten-child</artifactId>
</project>

install/deploy后父子pom.xml中的${reversion1}沒有被替換

  • 使用了flatten-maven-plugin

1.父pom定義版本為變量reversion并作為version,子pom復引用變量reversion作為version

2.使用flatten-maven-plugin并設置updatePomFile=true,并綁定goal到maven周期

3.在process-resources階段時會在父子project目錄下生成.flattened-pom.xml(version已替換為具體值)

4.運行install或deploy時會將.flattened-pom.xml替換原來的pom.xml

原始父pom

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <version>${reversion2}</version>
    <packaging>pom</packaging>
    <artifactId>use-flatten-parent</artifactId>
		<groupId>com.wsl.my.maven</groupId>
    <modules>
        <module>use-flatten-child</module>
    </modules>
    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <reversion2>1.2.0-SNAPSHOT</reversion2>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
                <version>1.2.7</version>
                <configuration>
                    <updatePomFile>true</updatePomFile>
                    <flattenMode>resolveCiFriendliesOnly</flattenMode>
                </configuration>
                <executions>
                    <execution>
                        <id>flatten</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>flatten</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>flatten-clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

到此這篇關于flatten-maven-plugin使用的文章就介紹到這了,更多相關flatten-maven-plugin使用內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

  • MyBatis傳入?yún)?shù)為List對象的實現(xiàn)

    MyBatis傳入?yún)?shù)為List對象的實現(xiàn)

    這篇文章主要介紹了MyBatis傳入?yún)?shù)為List對象的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2021-03-03
  • 詳解SpringBoot之訪問靜態(tài)資源(webapp...)

    詳解SpringBoot之訪問靜態(tài)資源(webapp...)

    這篇文章主要介紹了詳解SpringBoot之訪問靜態(tài)資源(webapp...),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-09-09
  • java8 Future異步調用實現(xiàn)方式

    java8 Future異步調用實現(xiàn)方式

    文章介紹了同步與異步調用的區(qū)別,Java中通過Future和CompletableFuture實現(xiàn)異步任務,后者提供更簡潔的API,比較了流順序執(zhí)行、并行及自定義異步執(zhí)行的效率,指出并行和自定義異步顯著提升性能
    2025-09-09
  • 原理分析SonarQube中IdentityProvider賬戶互斥現(xiàn)象

    原理分析SonarQube中IdentityProvider賬戶互斥現(xiàn)象

    這篇文章主要為大家介紹分析SonarQube中IdentityProvider賬戶互斥現(xiàn)象原理,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步
    2022-02-02
  • Java Stream 的 forEachOrdered 與 forEach的區(qū)別與適用場景

    Java Stream 的 forEachOrdered 與 forE

    在Java Stream API中,forEach和forEachOrdered是兩個常用的終止操作,用于對流中的元素執(zhí)行迭代處理,本文將從多個維度深入分析Java Stream的forEachOrdered與forEach的區(qū)別與適用場景,感興趣的朋友一起看看吧
    2025-08-08
  • Ehcache簡介_動力節(jié)點Java學院整理

    Ehcache簡介_動力節(jié)點Java學院整理

    這篇文章主要介紹了Ehcache簡介,使用Spring的AOP進行整合,可以靈活的對方法的返回結果對象進行緩存
    2017-07-07
  • java用list集合存儲學生信息并算出成績平均值操作

    java用list集合存儲學生信息并算出成績平均值操作

    這篇文章主要介紹了java用list集合存儲學生信息并算出成績平均值操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-08-08
  • SpringBoot集成ZXing實現(xiàn)二維碼的生成與讀取功能

    SpringBoot集成ZXing實現(xiàn)二維碼的生成與讀取功能

    本教程將詳細講解如何在 Spring Boot 項目中集成 ZXing 庫實現(xiàn)二維碼的生成(返回 Base64 編碼)和讀?。ń馕鰣D片的二維碼)功能,并覆蓋常見異常處理、參數(shù)優(yōu)化等實戰(zhàn)要點,適合 Java 開發(fā)新手快速上手,需要的朋友可以參考下
    2026-03-03
  • Java上傳文件進度條的實現(xiàn)方法(附demo源碼下載)

    Java上傳文件進度條的實現(xiàn)方法(附demo源碼下載)

    這篇文章主要介紹了Java上傳文件進度條的實現(xiàn)方法,可簡單實現(xiàn)顯示文件上傳比特數(shù)及進度的功能,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下
    2015-12-12
  • IDEA整合Dubbo+Zookeeper+SpringBoot實現(xiàn)

    IDEA整合Dubbo+Zookeeper+SpringBoot實現(xiàn)

    初學者,想自己動手做一個簡單的demo,本文主要介紹了IDEA整合Dubbo+Zookeeper+SpringBoot實現(xiàn),需要的朋友們下面隨著小編來一起學習學習吧
    2021-06-06

最新評論

潜山县| 洛浦县| 宜君县| 华容县| 抚宁县| 大丰市| 南岸区| 交口县| 广东省| 光山县| 祁连县| 绥芬河市| 同仁县| 永昌县| 永年县| 铁岭市| 普兰店市| 清原| 塘沽区| 额尔古纳市| 白沙| 财经| 岐山县| 汕头市| 五原县| 城固县| 图片| 鄢陵县| 张家港市| 竹山县| 九江市| 昆山市| 葵青区| 临湘市| 新安县| 冀州市| 凤冈县| 曲阜市| 大兴区| 务川| 蒲城县|