国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術(shù)文章
文章詳情頁

Springboot如何基于assembly服務(wù)化實(shí)現(xiàn)打包

瀏覽:3日期:2023-05-11 17:38:17

(1)首先我們編輯 assembly.xml 配置文件,在前文的基礎(chǔ)上新增第三方依賴設(shè)置(高亮部分),實(shí)現(xiàn)將第三方的 jar 包添加到壓縮包里的 lib 目錄:

<?xml version='1.0' encoding='UTF-8'?><assembly> <!-- 必須寫,否則打包時(shí)會有 assembly ID must be present and non-empty 錯(cuò)誤 這個(gè)名字最終會追加到打包的名字的末尾,如項(xiàng)目的名字為 hangge-test-0.0.1-SNAPSHOT, 則最終生成的包名為 hangge-test-0.0.1-SNAPSHOT-bin.tar.gz --> <id>bin</id> <!-- 打包的類型,如果有N個(gè),將會打N個(gè)類型的包 --> <formats><!-- <format>tar.gz</format>--> <format>zip</format> </formats> <includeBaseDirectory>true</includeBaseDirectory> <!--第三方依賴設(shè)置--> <dependencySets> <dependencySet> <!-- 不使用項(xiàng)目的artifact,第三方j(luò)ar不要解壓,打包進(jìn)zip文件的lib目錄 --> <useProjectArtifact>false</useProjectArtifact> <outputDirectory>lib</outputDirectory> <unpack>false</unpack> </dependencySet> </dependencySets> <!--文件設(shè)置--> <fileSets> <!-- 0755->即用戶具有讀/寫/執(zhí)行權(quán)限,組用戶和其它用戶具有讀寫權(quán)限; 0644->即用戶具有讀寫權(quán)限,組用戶和其它用戶具有只讀權(quán)限; --> <!-- 將src/main/assembly/bin目錄下的所有文件輸出到打包后的bin目錄中 --> <fileSet> <directory>src/main/assembly/bin</directory> <outputDirectory>bin</outputDirectory> <fileMode>0755</fileMode> <!--如果是腳本,一定要改為unix.如果是在windows上面編碼,會出現(xiàn)dos編寫問題--> <lineEnding>unix</lineEnding> <filtered>true</filtered><!-- 是否進(jìn)行屬性替換 --> </fileSet> <!-- 將src/main/assembly/config目錄下的所有文件輸出到打包后的config目錄中 --> <fileSet> <directory>src/main/assembly/config</directory> <outputDirectory>config</outputDirectory> <fileMode>0644</fileMode> </fileSet> <!-- 將src/main/resources下配置文件打包到config目錄 --> <fileSet> <directory>src/main/resources</directory> <outputDirectory>./config</outputDirectory> <includes><include>**/*.xml</include><include>**/*.properties</include><include>**/*.yml</include> </includes> <filtered>true</filtered><!-- 是否進(jìn)行屬性替換 --> </fileSet> <!-- 將項(xiàng)目啟動jar打包到lib目錄中 --> <fileSet> <directory>target</directory> <outputDirectory>./</outputDirectory> <includes><include>*.jar</include> </includes> </fileSet> <!-- 將項(xiàng)目說明文檔打包到docs目錄中 --> <!-- <fileSet> <directory>.</directory> <outputDirectory>./docs</outputDirectory> <includes><include>*.md</include> </includes> <fileMode>0644</fileMode> </fileSet>--> <fileSet> <directory>docs</directory> <outputDirectory>./docs</outputDirectory> <fileMode>0644</fileMode> </fileSet> <fileSet> <directory>src/main/assembly/docs</directory> <outputDirectory>./docs</outputDirectory> <fileMode>0644</fileMode> </fileSet> </fileSets></assembly>

(2)接著編輯項(xiàng)目的 pom.xml 文件,先前使用的是 spring-boot-maven-plugin 來打包,這個(gè)插件會將項(xiàng)目所有的依賴打入項(xiàng)目 jar 包里面。我們將其替換為 maven-jar-plugin,并進(jìn)行相關(guān)設(shè)置

<build> <plugins> <!-- 指定啟動類,將依賴打成外部jar包 --> <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId><configuration> <archive> <!-- 生成的jar中,不要包含pom.xml和pom.properties這兩個(gè)文件 --> <addMavenDescriptor>false</addMavenDescriptor> <manifest> <!-- 是否要把第三方j(luò)ar加入到類構(gòu)建路徑 --> <addClasspath>true</addClasspath> <!-- 外部依賴jar包的最終位置 --> <!-- 因?yàn)槲覀儗⒌谌絡(luò)ar和本項(xiàng)目jar放在同一個(gè)目錄下,這里就使用./ --> <classpathPrefix>./lib</classpathPrefix> <!-- 項(xiàng)目啟動類 --> <mainClass>com.yuehang.disneyland.DisneylandApplication</mainClass> </manifest> </archive></configuration> </plugin> <plugin><!--主要使用的是maven提供的assembly插件完成--><artifactId>maven-assembly-plugin</artifactId><version>3.1.1</version><configuration> <descriptors> <!--具體的配置文件--> <descriptor>src/main/assembly/assembly.xml</descriptor> </descriptors></configuration><executions> <execution> <id>make-assembly</id> <!--綁定到maven操作類型上--> <phase>package</phase> <!--運(yùn)行一次--> <goals> <goal>single</goal> </goals> </execution></executions> </plugin> </plugins> </build>

然后打包出來的結(jié)構(gòu)

Springboot如何基于assembly服務(wù)化實(shí)現(xiàn)打包

運(yùn)行就ok了

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Spring
相關(guān)文章:
主站蜘蛛池模板: 欧美精品成人久久网站 | 亚洲人在线播放 | 免费人成综合在线视频 | 国产农村乱子伦精品视频 | 亚洲精品视频观看 | 中国美女黄色一级片 | 性色tv| 国产亚洲福利一区二区免费看 | 日韩一区二区在线免费观看 | 精品九九久久 | 久久福利资源站免费观看i 久久高清精品 | 两性色午夜视频免费国产 | 日本三级网站 | 国产做a爰片久久毛片a | 免费人成在线观看播放国产 | 亚洲国产成人精品91久久久 | 国产日韩精品一区在线观看播放 | 欧美成人在线影院 | 日本久久久久久久 | 亚洲精品一区专区 | 久久三级毛片 | 99re久久资源最新地址 | 久草网视频在线观看 | 在线观看aaa | 成人免费大片a毛片 | 国产网址在线观看 | 久久精品国产三级不卡 | 一级片aaaa | 中文国产成人精品久久一区 | 国产精品免费久久 | 高清精品一区二区三区一区 | 91亚洲精品久久91综合 | 亚洲国产成人久久精品影视 | 亚洲视频免费在线看 | 日本美女一区二区三区 | 亚洲日本久久一区二区va | 国产欧美日韩中文久久 | 韩国免又爽又刺激激情视频 | 日韩成人小视频 | 91久久国产综合精品女同国语 | 欧美一级免费在线观看 |