基于spring-boot-maven-plugin插件打包lib文件外置的方法(layout模式為ZIP模式)
本篇文章為自己親自實(shí)踐所得,項(xiàng)目是基于 spring boot 的多模塊 Maven 項(xiàng)目, 依賴(lài)錯(cuò)綜復(fù)雜。參考網(wǎng)上千篇一律的復(fù)制文章躺了不少坑。
整體感覺(jué)下來(lái),Maven就是一把利劍,理解的到位,能化腐朽為神奇,基礎(chǔ)不牢,費(fèi)心費(fèi)神。為了減小本文篇幅,基礎(chǔ)知識(shí)一定要參考apache maven 官網(wǎng)學(xué)習(xí)
為了少走彎路,基礎(chǔ)插件知識(shí)請(qǐng)進(jìn)入官網(wǎng)學(xué)習(xí):https://maven.apache.org/plugins/index.html
正文
乍一看,Maven 可能看起來(lái)有很多東西,但簡(jiǎn)而言之,maven是將項(xiàng)目工程模式應(yīng)用于項(xiàng)目構(gòu)建的基礎(chǔ)架構(gòu)。
講人話就是:Maven是一個(gè)插件執(zhí)行框架;所有工作都由插件完成。同時(shí) Maven 基于構(gòu)建生命周期的核心概念,明確定義了構(gòu)建和分發(fā)特定工件(項(xiàng)目)的過(guò)程。
本次用到的插件
非官方插件
插件 | 作用 |
---|---|
spring-boot-maven-plugin | spring boot官方打包插件,本次使用其 layout 為 ZIP 的模式進(jìn)行打包 |
官方插件:
插件 | 作用 |
---|---|
spring-boot-maven-plugin | spring boot官方打包插件,本次使用其 layout 為 ZIP 的模式進(jìn)行打包 |
官方插件:
插件 | 作用 |
---|---|
maven-resources-plugin | 資源文件處理插件,配置文件中的 @…@ 包圍的變量 |
maven-dependency-plugin | 依賴(lài)操作(復(fù)制、解包)和分析。本次用來(lái)將依賴(lài)的 jar 包移到lib文件夾中 |
maven-assembly-plugin | 構(gòu)建源和/或二進(jìn)制文件的程序包(分發(fā))。比如打包成 zip 文件 |
maven插件有著自己的一套命名規(guī)范。官方插件命名的格式為 [maven-xxx
-plugin],非官方的插件命名為 [xxx
-maven-plugin] 。是不是覺(jué)得很眼熟,沒(méi)錯(cuò),spring boot starter 的命名也有類(lèi)似的規(guī)范。
如下幾個(gè)插件可以看其名字就能區(qū)分是maven官方的還是非官方的:spring-boot-maven-plugin、maven-surefire-plugin、maven-resources-plugin
官方插件可以詳見(jiàn)官方地址:https://maven.apache.org/plugins/index.html
小步慢跑實(shí)現(xiàn):jar包瘦身,lib包外置
千萬(wàn)不要想著一步實(shí)現(xiàn)lib包外置,我們的目標(biāo)是將lib包外置,網(wǎng)上一堆文章直接貼整體配置文檔,注釋和當(dāng)時(shí)什么地方有坑言之較少,所以我們還是得按自己的想法進(jìn)行嘗試,確保問(wèn)題控制在自己的掌控范圍之內(nèi)。
目標(biāo): 實(shí)現(xiàn)lib外置
準(zhǔn)備工作:
- 打包fast jar ,因?yàn)槭褂玫氖?spring boot項(xiàng)目,使用官方提供的插件進(jìn)行打包。
- 使用 spring-boot-maven-plugin 插件,layout加載方式改為 ZIP 模式可以實(shí)現(xiàn)。(因?yàn)樵摬寮窃趍aven-jar-plugin 插件之后執(zhí)行)
使用官方的 maven-jar-plugin(我嘗試過(guò)但是依賴(lài)導(dǎo)入會(huì)有問(wèn)題總是報(bào)錯(cuò)“java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy”類(lèi)型的錯(cuò)誤,因?yàn)镸ANIFEST.MF文件中Class-Path參數(shù)不能個(gè)性化排除業(yè)務(wù)jar。所以我調(diào)試無(wú)果之后僅使用的是spring boot的官方插件)
- 有哪些方法可以實(shí)現(xiàn) fast jar中的lib文件中的jar包移到j(luò)ar外部的文件夾中
需要使用 maven-dependency-plugin 插件 - fast jar的內(nèi)部結(jié)構(gòu)了解,了解打包插件最終修改的是哪些參數(shù)。
MANIFEST.MF
文件及其參數(shù)了解, BOOT-INF文件夾作用 - pom文件中
build
配置的標(biāo)簽有哪些自己不知道的,比如 configuration 參數(shù)如何查詢(xún)(官方文檔) - spring-boot-maven-plugin 插件能實(shí)現(xiàn)哪些功能,phase、goals
- 經(jīng)了解spring-boot-maven-plugin 實(shí)現(xiàn)lib 外置需要,切換打包方式
<layout>ZIP</layout>
啟用-Dloader.path=lib/
- 使用 includes 標(biāo)簽可以將匹配的 jar 保留在原來(lái)的BOOT-INF/lib中
- 經(jīng)了解spring-boot-maven-plugin 實(shí)現(xiàn)lib 外置需要,切換打包方式
實(shí)踐的基本步驟
- 切換layout 為 ZIP模式,確保項(xiàng)目啟動(dòng)成功
- 先將lib包全部外置,確保項(xiàng)目再次啟動(dòng)成功。(需要使用-Dloader.path=lib/ 啟動(dòng)參數(shù))
- 過(guò)濾業(yè)務(wù)相關(guān)的jar,打包到 fast jar 中,啟動(dòng)肯定是要報(bào)錯(cuò),錯(cuò)誤來(lái)源與外部lib的jar包
- 配置maven-dependency-plugin 排除業(yè)務(wù)jar放入外置lib文件夾中。
先看成果最終信息
啟動(dòng)的時(shí)候需要增加 -Dloader.path=lib/
參數(shù),以下只是一個(gè)簡(jiǎn)單的啟動(dòng)命令:
java -jar -Dloader.path=lib/ gd_mbs_zfxn.jar
文件結(jié)構(gòu),jar包因?yàn)榱吮阌谡故窘Y(jié)構(gòu),已解壓成文件
. 本文件夾
├─gd_mbs_zfxn.jar## jar 包
│ ├─BOOT-INF
│ │ ├─classes
│ │ │ ├─com
│ │ │ │ └─****## 省略詳細(xì)信息,主要包含的啟動(dòng)類(lèi)的class文件,對(duì)應(yīng)MANIFEST.MF 文件的 Start-Class項(xiàng)
│ │ │ ├─config## 存放配置文件 yml,xml 等等
│ │ │ ├─templates
│ │ │ │ └─license
│ │ │ └─xml
│ │ └─lib## 還有項(xiàng)目依賴(lài)的業(yè)務(wù) jar 包
│ ├─META-INF
│ │ └─maven
│ │ └─com.bdsoft.framework.gd
│ │ └─leea-app
│ └─org
│ └─springframework
│ └─boot
│ └─loader
│ ├─archive
│ ├─data
│ ├─jar
│ └─util
└─lib
1.所得jar包中: MANIFEST.MF 文件內(nèi)容如下,請(qǐng)注意 Main-Class是PropertiesLauncher
,這個(gè)是pom中 spring-boot-maven-plugin 插件配置 <layout>ZIP</layout>
的結(jié)果。
Manifest-Version: 1.0 Implementation-Title: APP啟動(dòng)配置 Implementation-Version: 1.0.0.0 Start-Class: com.bdsoft.BDPWebApplication Spring-Boot-Classes: BOOT-INF/classes/ Spring-Boot-Lib: BOOT-INF/lib/ Build-Jdk-Spec: 1.8 Spring-Boot-Version: 2.2.7.RELEASE Created-By: Maven Jar Plugin 3.2.0 Main-Class: org.springframework.boot.loader.PropertiesLauncher
2.配置文件不外置,仍然放在jar的原來(lái)位置 BOOT-INF/classes 文件下面
這個(gè)需要
3.業(yè)務(wù)jar仍然放在jar內(nèi)部的 BOOT-INF/lib 文件下.
4.非業(yè)務(wù)的其他依賴(lài)jar包(不包含3中的三個(gè)業(yè)務(wù)jar)全部放置在啟動(dòng)jar(fast jar)同級(jí)的 lib文件夾下面。
全部 pom配置
<build> <finalName>gd_mbs_zfxn</finalName> <!-- mavne打包動(dòng)態(tài)修改替換配置文件中的占位符 --> <resources> <resource> <directory>${basedir}/src/main/resources</directory> <!-- 處理其中的可替換參數(shù)(@..@符合標(biāo)注的變量) --> <filtering>true</filtering> </resource> <!-- 可以配置引入哪些配置文件includes或排除哪些文件excludes --> </resources> <plugins> <!-- spring boot的打包插件進(jìn)行打包成 fastjar --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.2.7.RELEASE</version> <configuration> <!-- --> <layout>ZIP</layout> <includeSystemScope>true</includeSystemScope> <mainClass>com.bdsoft.BDPWebApplication</mainClass> <includes> <!-- 項(xiàng)目啟動(dòng)jar包中保留依賴(lài)包 --> <include> <groupId>com.bdsoft.framework.gd</groupId> <artifactId>leea-sym</artifactId> </include> <include> <groupId>com.bdsoft.framework.gd</groupId> <artifactId>leea-efficiency</artifactId> </include> <include> <groupId>com.googlecode.aviator</groupId> <artifactId>leea-aviator</artifactId> </include> </includes> </configuration> <executions> <execution> <goals> <!-- 這個(gè)是默認(rèn) goal,在 mvn package 執(zhí)行之后,這個(gè)命令再次打包生成可執(zhí)行的 jar,同時(shí)將 mvn package 生成的 jar 重命名為 *.origin --> <goal>repackage</goal> </goals> </execution> </executions> </plugin> <!--打包時(shí)跳過(guò)測(cè)試代碼--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.2</version> <configuration> <skip>true</skip> </configuration> </plugin> <!-- 配置文件處理插件 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>3.1.0</version> <configuration> <encoding>utf-8</encoding> <!-- 是否使用默認(rèn)占位符@@ --> <useDefaultDelimiters>true</useDefaultDelimiters> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.1.0</version> <executions> <!--導(dǎo)出所有的 jar 包--> <execution> <id>pra1</id> <!-- (打包階段):在實(shí)際打包中,執(zhí)行任何的必要的操作。 --> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> <stripVersion>false</stripVersion> <!-- 不包含哪些jar包 --> <excludeGroupIds> <!-- 只排除業(yè)務(wù)模塊相關(guān)的jar包,多個(gè)用英文逗號(hào)分割--> com.bdsoft.framework.gd, com.googlecode.aviator </excludeGroupIds> </configuration> </execution> </executions> </plugin> <!-- 打包zip插件 --> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>3.4.2</version> <configuration> <descriptors> <descriptor>src/main/assembly/assembly.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
maven-assembly-plugin 插件對(duì)應(yīng)的 assembly.xml 內(nèi)容如下
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.1 https://maven.apache.org/xsd/assembly-2.1.1.xsd"> <!-- 可自定義,這里指定的是項(xiàng)目環(huán)境 --> <!-- gd_mbs_zfxn-dev-1.0.0.0.tar.gz --> <id>${profiles.active}-${project.version}</id> <!-- 打包的類(lèi)型,如果有N個(gè),將會(huì)打N個(gè)類(lèi)型的包 --> <formats> <format>tar.gz</format> <format>zip</format> </formats> <!-- 默認(rèn)為true。指定打的包是否包含打包層目錄(比如finalName是prefix,當(dāng)值為true,所有文件被放在包內(nèi)的prefix目錄下, 否則直接放在包的根目錄下。finalName標(biāo)簽在pom文件中注冊(cè)插件里面的configuration標(biāo)簽下 --> <includeBaseDirectory>false</includeBaseDirectory> <!-- 指定要包含在程序集中的文件組。通過(guò)提供一個(gè)或多個(gè) <fileSet> 子元素來(lái)指定文件集。 --> <fileSets> <!-- fileMode,還有一個(gè) directoryMode 與 UNIX 權(quán)限類(lèi)似,設(shè)置所包含文件的文件模式。這是一個(gè)八進(jìn)制值。格式:(User)(Group)(Other) 其中每個(gè)組件是 Read = 4、Write = 2 和 Execute = 1 的總和。例如,值 0644 轉(zhuǎn)換為 User read-write、Group and Other read-only . 默認(rèn)值為 0644 0755->即用戶(hù)具有讀/寫(xiě)/執(zhí)行權(quán)限,組用戶(hù)和其它用戶(hù)具有讀寫(xiě)權(quán)限; 0644->即用戶(hù)具有讀寫(xiě)權(quán)限,組用戶(hù)和其它用戶(hù)具有只讀權(quán)限; --> <!-- 將src/bin目錄下的所有文件輸出到打包后的bin目錄中 --> <fileSet> <directory>${basedir}/src/bin</directory> <outputDirectory>bin</outputDirectory> <fileMode>0755</fileMode> <includes> <include>**.sh</include> <include>**.bat</include> </includes> </fileSet> <!-- 指定輸出target/classes中的配置文件到config目錄中 --> <fileSet> <directory>${project.build.directory}/classes</directory> <outputDirectory>config</outputDirectory> <fileMode>0644</fileMode> <includes> <!-- 啟動(dòng)必須的的 bootstrap文件 --> <include>**/bootstrap.yml</include> <!-- 主要配置文件、system配置文件和對(duì)應(yīng)環(huán)境${profiles.active}的文件 --> <include>**/application.yml</include> <include>**/application-system.yml</include> <include>**/application-${profiles.active}.yml</include> <!-- mybatis文件 暫時(shí)冗余 --> <include>mapper/**/*.xml</include> <!-- 靜態(tài)文件 暫時(shí)冗余 --> <include>static/**</include> <!-- 模板文件 --> <include>templates/**</include> <!-- 全部的xml文件 --> <include>**/*.xml</include> <!-- 全部的配置文件 --> <include>**/*.properties</include> <include>**/*.txt</include> </includes> </fileSet> <!-- 將第三方依賴(lài)打包到lib目錄中 --> <fileSet> <directory>${basedir}/target/lib</directory> <outputDirectory>lib</outputDirectory> <fileMode>0755</fileMode> </fileSet> <!-- 將項(xiàng)目啟動(dòng)jar打包到boot目錄中,target文件夾下 --> <fileSet> <directory>${project.build.directory}</directory> <outputDirectory></outputDirectory> <fileMode>0755</fileMode> <includes> <include>${project.build.finalName}.jar</include> </includes> </fileSet> <!-- 包含根目錄下的文件 --> <fileSet> <directory>${basedir}</directory> <includes> <include>*.md</include> </includes> </fileSet> </fileSets> </assembly>
上的${profiles.active}
變量來(lái)源于下面的profiles設(shè)置,如果不需要?jiǎng)討B(tài)配置文件,可以忽略將上面相關(guān)變量${profiles.active}
刪除。
<profiles> <profile> <!-- 生產(chǎn)環(huán)境 --> <id>pross</id> <properties> <!-- 激活的環(huán)境 --> <profiles.active>pro</profiles.active> <!-- 其他參數(shù)的配置,編譯打包的時(shí)候替換資源文件中的 @testparam@ 變量 --> <testparam>xxx</testparam> </properties> </profile> <profile> <!-- 預(yù)發(fā)布環(huán)境 --> <id>prepro</id> <properties> <!-- 激活的環(huán)境文件 --> <profiles.active>prepro</profiles.active> <!-- 其他參數(shù)的配置,編譯打包的時(shí)候替換資源文件中的 @testparam@ 變量 --> <testparam>xxx</testparam> </properties> </profile> <profile> <!-- 本地開(kāi)發(fā)環(huán)境 --> <id>dev</id> <properties> <!-- 激活的環(huán)境文件 --> <profiles.active>dev</profiles.active> <!-- 其他參數(shù)的配置,編譯打包的時(shí)候替換資源文件中的 @testparam@ 變量 --> <testparam>xxx</testparam> </properties> <activation> <!-- 默認(rèn)選中本地環(huán)境 --> <activeByDefault>true</activeByDefault> </activation> </profile> <profile> <!-- 測(cè)試環(huán)境 --> <id>test</id> <properties> <!-- 激活的環(huán)境文件 --> <profiles.active>test</profiles.active> <!-- 其他參數(shù)的配置,編譯打包的時(shí)候替換資源文件中的 @testparam@ 變量 --> <testparam>xxx</testparam> </properties> </profile> </profiles>
業(yè)務(wù) jar 的位置操作
想要實(shí)現(xiàn)業(yè)務(wù) jar 仍然放在jar內(nèi)部的 BOOT-INF/lib 文件下,其他依賴(lài) jar 放入 lib文件夾中,需要兩個(gè)插件配合。maven-dependency-plugin 和 spring-boot-maven-plugin 插件在 package 階段根據(jù)各自的匹配策略將 業(yè)務(wù)jar 排除和匹配放入
核心思路就是:
- 我們想實(shí)現(xiàn)的目的是什么,這個(gè)目的處在maven生命周期的什么階段,對(duì)應(yīng)使用什么插件(<plugin>)
- 我們的目的需要在什么觸發(fā)事件中執(zhí)行(<execution><phase>)
- 我們的目的需要什么組件去實(shí)現(xiàn),是測(cè)試組件還是打包組件還是依賴(lài)組件。將我們的想法分解成符合maven的工程概念,并找到其中合適的組件,配置它提供的<goals><goal>(對(duì)應(yīng)Mojo)目標(biāo)功能(dependency)實(shí)現(xiàn)我們的目的。讓它操作基于我們提供的匹配原則(includes符合或excludes排除)符合的文件<configuration>
核心注意點(diǎn):
- jar 包是在package階段,我們需要將依賴(lài)jar導(dǎo)出到lib包中,可以使用為了便于理解我都采用的是 package階段
- spring-boot-maven-plugin 插件中僅放行 業(yè)務(wù)jar 打入fast jar,請(qǐng)看
<include>
標(biāo)簽,因?yàn)槟J(rèn) goal 是repackage,對(duì)應(yīng)的是mvn package,maven-dependency-plugin 插件也使用 package 階段,該插件使用詳見(jiàn):https://docs.spring.io/spring-boot/docs/2.2.1.RELEASE/maven-plugin/
<includes> <!-- 項(xiàng)目啟動(dòng)jar包中保留依賴(lài)包 --> <include> <groupId>com.bdsoft.framework.gd</groupId> <artifactId>leea-sym</artifactId> </include> <include> <groupId>com.bdsoft.framework.gd</groupId> <artifactId>leea-efficiency</artifactId> </include> <include> <groupId>com.googlecode.aviator</groupId> <artifactId>leea-aviator</artifactId> </include> </includes>
3.maven-dependency-plugin插件中不能再將 業(yè)務(wù)jar 輸出到外置 lib 文件夾,所以需要排除相應(yīng)的業(yè)務(wù)jar,不然會(huì)在啟動(dòng)的時(shí)候報(bào)創(chuàng)建bean失敗的錯(cuò)誤,詳見(jiàn) excludeGroupIds
標(biāo)簽,記得使用 英文逗號(hào)分割,該插件使用詳見(jiàn):https://maven.apache.org/plugins/maven-dependency-plugin/,排除依賴(lài)相關(guān)說(shuō)明詳見(jiàn)copy-dependencies的文檔:https://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.1.0</version> <executions> <!--導(dǎo)出所有的 jar 包--> <execution> <id>pra1</id> <!-- (打包階段):在實(shí)際打包中,執(zhí)行任何的必要的操作。 --> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> <stripVersion>false</stripVersion> <!-- 不包含哪些jar包 --> <excludeGroupIds> <!-- 只排除業(yè)務(wù)模塊相關(guān)的jar包,多個(gè)用英文逗號(hào)分割--> com.bdsoft.framework.gd, com.googlecode.aviator </excludeGroupIds> </configuration> </execution> </executions> </plugin>
maven的 package 打包時(shí)的詳細(xì)信息 插件的執(zhí)行順序
maven-resources-plugin resources (default-resources)
maven-compiler-plugin compile (default-compile)
maven-resources-plugin testResources (default-testResources)
maven-compiler-plugin testCompile (default-testCompile)
maven-surefire-plugin test (default-test)
maven-jar-plugin jar (default-jar)
spring-boot-maven-plugin repackage (repackage)
spring-boot-maven-plugin repackage (default)
maven-dependency-plugin copy-dependencies (pra1) 【pra1 是execution 定義的id】
maven-assembly-plugin single (make-assembly)
詳細(xì)日志如下:
[INFO] ------------------< com.bdsoft.framework.gd:leea-app >------------------ [INFO] Building APP啟動(dòng)配置 1.0.0.0 [5/6] [INFO] --------------------------------[ jar ]--------------------------------- .... [INFO] [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ leea-app --- [INFO] Using 'utf-8' encoding to copy filtered resources. [INFO] Copying 16 resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ leea-app --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 13 source files to D:\work\workspaces\workspace-af\xxxxxxxxxxx\gd_mbs_zfxn\xxxx\leea-app\target\classes [INFO] /D:/work/workspaces/workspace-af/xxxxxxxxxxx/gd_mbs_zfxn/xxxx/leea-app/src/main/java/com/bdsoft/config/system/GlobalCorsConfig.java: 某些輸入文件使用或覆蓋了已過(guò)時(shí)的 API。 [INFO] /D:/work/workspaces/workspace-af/xxxxxxxxxxx/gd_mbs_zfxn/xxxx/leea-app/src/main/java/com/bdsoft/config/system/GlobalCorsConfig.java: 有關(guān)詳細(xì)信息, 請(qǐng)使用 -Xlint:deprecation 重新編譯。 [INFO] [INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ leea-app --- [INFO] Using 'utf-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\work\workspaces\workspace-af\xxxxxxxxxxx\gd_mbs_zfxn\xxxx\leea-app\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ leea-app --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ leea-app --- [INFO] Tests are skipped. [INFO] [INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ leea-app --- [INFO] Building jar: D:\work\workspaces\workspace-af\xxxxxxxxxxx\gd_mbs_zfxn\xxxx\leea-app\target\gd_mbs_zfxn.jar [INFO] [INFO] --- spring-boot-maven-plugin:2.2.7.RELEASE:repackage (repackage) @ leea-app --- [INFO] Layout: ZIP [INFO] Replacing main artifact with repackaged archive [INFO] [INFO] --- spring-boot-maven-plugin:2.2.7.RELEASE:repackage (default) @ leea-app --- [INFO] Layout: ZIP [INFO] Replacing main artifact with repackaged archive [INFO] [INFO] --- maven-dependency-plugin:3.1.0:copy-dependencies (pra1) @ leea-app --- [INFO] Copying tomcat-embed-websocket-9.0.37.jar to D:\work\workspaces\workspace-af\xxxxxxxxxxx\gd_mbs_zfxn\xxxx\leea-app\target\lib\tomcat-embed-websocket-9.0.37.jar [INFO] Copying lombok-1.18.12.jar to D:\work\workspaces\workspace-af\xxxxxxxxxxx\gd_mbs_zfxn\xxxx\leea-app\target\lib\lombok-1.18.12.jar .... [INFO] [INFO] --- maven-assembly-plugin:3.4.2:single (make-assembly) @ leea-app --- [INFO] Reading assembly descriptor: src/main/assembly/assembly.xml [INFO] Building tar: D:\work\workspaces\workspace-af\xxxxxxxxxxx\gd_mbs_zfxn\xxxx\leea-app\target\gd_mbs_zfxn-dev-1.0.0.0.tar.gz [INFO] Building zip: D:\work\workspaces\workspace-af\xxxxxxxxxxx\gd_mbs_zfxn\xxxx\leea-app\target\gd_mbs_zfxn-dev-1.0.0.0.zip [INFO]
總結(jié)
不要盲目相信網(wǎng)上 各種拷貝粘貼文,有問(wèn)題第一時(shí)間應(yīng)該去閱讀一下官方的文檔,畢竟官方才是理解最深的那位,文檔也是最淺顯易懂的。
到此這篇關(guān)于基于spring-boot-maven-plugin插件打包lib文件外置(layout模式為ZIP模式)的文章就介紹到這了,更多相關(guān)spring-boot-maven-plugin插件打包內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- spring-boot-maven-plugin:打包時(shí)排除provided依賴(lài)問(wèn)題
- springboot實(shí)現(xiàn)maven多模塊和打包部署
- Springboot 使用maven release插件執(zhí)行版本管理及打包操作
- maven?springboot如何將jar包打包到指定目錄
- Spring Boot Maven Plugin打包異常解決方案
- SpringBoot使用Maven插件進(jìn)行項(xiàng)目打包的方法
- SpringBoot+Maven 多模塊項(xiàng)目的構(gòu)建、運(yùn)行、打包實(shí)戰(zhàn)
- Spring Boot如何獲取maven打包時(shí)間
相關(guān)文章
JDK動(dòng)態(tài)代理之WeakCache緩存的實(shí)現(xiàn)機(jī)制
這篇文章主要介紹了JDK動(dòng)態(tài)代理之WeakCache緩存的實(shí)現(xiàn)機(jī)制2018-02-02java配置多個(gè)過(guò)濾器優(yōu)先級(jí)以及幾個(gè)常用過(guò)濾器操作
這篇文章主要介紹了java配置多個(gè)過(guò)濾器優(yōu)先級(jí)以及幾個(gè)常用過(guò)濾器的操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-07-07簡(jiǎn)單了解springboot中的配置文件相關(guān)知識(shí)
這篇文章主要介紹了簡(jiǎn)單了解springboot中的配置文件相關(guān)知識(shí),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-11-11Java Socket通信介紹及可能遇到的問(wèn)題解決
最近在學(xué)習(xí)Java中的Socket通信,所以下面這篇文章主要給大家介紹了關(guān)于Java Socket通信介紹及可能遇到問(wèn)題的解決方法,文中通過(guò)示例代碼介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面隨著小編來(lái)一起看看吧。2017-10-10springboot+camunda實(shí)現(xiàn)工作流的流程分析
Camunda是基于Java語(yǔ)言,支持BPMN標(biāo)準(zhǔn)的工作流和流程自動(dòng)化框架,并且還支持CMMN規(guī)范,DMN規(guī)范,本文給大家介紹springboot+camunda實(shí)現(xiàn)工作流的流程分析,感興趣的朋友一起看看吧2021-12-12Java Mybatis框架多表操作與注解開(kāi)發(fā)詳解分析
MyBatis 是一款優(yōu)秀的持久層框架,它支持自定義 SQL、存儲(chǔ)過(guò)程以及高級(jí)映射。MyBatis 免除了幾乎所有的 JDBC 代碼以及設(shè)置參數(shù)和獲取結(jié)果集的工作。MyBatis 可以通過(guò)簡(jiǎn)單的 XML 或注解來(lái)配置和映射原始類(lèi)型、接口和 Java POJO為數(shù)據(jù)庫(kù)中的記錄2021-10-10