<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      MAVEN構建分離依賴JAR

      MAVEN構建分離依賴JAR

      1. 背景說明

      在Springboot項目中,項目構建時,默認打包成一個可以執行的jar包.導致單一jar過大.項目部署過程中,需要把依賴的jar包和配置文件都單獨存放到指定的文件夾中.

      2. 插件配置

      1. maven-compiler-plugin 用于編譯java代碼
      2. maven-jar-plugin 用于構建jar包
      3. spring-boot-maven-plugin 用于構建Springboot項目
      4. maven-assembly-plugin 用于打包項目

      3. 編譯配置

      <!--小游戲 地心俠士 -->
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
           <annotationProcessorPaths>
            	<path>
            		<groupId>org.projectlombok</groupId>
            		<artifactId>lombok</artifactId>
            		<version>${lombok.version}</version>
            </path>
           </annotationProcessorPaths>
         </configuration>
      </plugin>
      

      4. 構建jar配置

      <!--小游戲 地心俠士 -->
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <configuration>
            <archive>
              <manifest>
            	 <useUniqueVersions>false</useUniqueVersions>
               <mainClass>com.herbert.Application</mainClass>
              </manifest>
            </archive>
            <excludes>
            	<exclude>*.properties</exclude>
            	<exclude>*.yml</exclude>
            	<exclude>**/mapper/*.xml</exclude>
            </excludes>
         </configuration>
      </plugin>
      

      5. 構建springboot項目配置

      其中主要配置 <layout>ZIP\</layout> 為關鍵配置,打包后的jar包對應MANIFEST.MF配置的啟動類為 Main-Class: org.springframework.boot.loader.PropertiesLauncher

      <!--小游戲 地心俠士 公眾號:小滿小慢 QQ:464884492-->
      <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <configuration>
      <layout>ZIP</layout>
      <includes>
      	<include>
      		<groupId>non-exists</groupId>
      		<artifactId>non-exists</artifactId>
      	</include>
      </includes>
      <excludes>
      	<exclude>
      		<groupId>org.projectlombok</groupId>
      		<artifactId>lombok</artifactId>
      	</exclude>
      </excludes>
      </configuration>
      </plugin>
      

      5. 項目整體打包配置

      <!--小游戲 地心俠士 公眾號:小滿小慢 QQ:464884492-->
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-assembly-plugin</artifactId>
         <configuration>
            <appendAssemblyId>false</appendAssemblyId>
            <descriptors>
            	<descriptor>./package.xml</descriptor>
            </descriptors>
            <outputDirectory>${project.basedir}/dist</outputDirectory>
         </configuration>
         <executions>
            <execution>
            	<id>make-assembly</id>
            	<phase>package</phase>
            	<goals>
            		<goal>single</goal>
            	</goals>
            </execution>
         </executions>
      </plugin>
      

      其中 package.xml文件內容如下

      <assembly
      	xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
      	<id>distribution</id>
      	<formats>
      		<format>zip</format>
      	</formats>
          <!--小游戲 地心俠士 公眾號:小滿小慢 QQ:464884492-->
      	<includeBaseDirectory>false</includeBaseDirectory>
      	<fileSets>
      		<fileSet>
      			<directory>src/main/resources/</directory>
      			<outputDirectory>/resources</outputDirectory>
      			<filtered>true</filtered>
      		</fileSet>
      		<fileSet>
      			<directory>${project.basedir}/script</directory>
      			<outputDirectory>/</outputDirectory>
      			<filtered>true</filtered>
      		</fileSet>
      		 <fileSet>
      		    <directory>${project.basedir}/web/</directory>
      			<outputDirectory>/resources/static</outputDirectory>
      		 </fileSet>
      	</fileSets>
      	<dependencySets>
      	  <dependencySet>
      			<outputDirectory>/lib</outputDirectory>
      			<scope>runtime</scope>
      			<excludes>
      				<exclude>${project.groupId}:${project.artifactId}</exclude>
      			</excludes>
      		</dependencySet>
      		<dependencySet>
      			<outputDirectory>/</outputDirectory>
      			<includes>
      				<include>${project.groupId}:${project.artifactId}</include>
      			</includes>
      		</dependencySet>
      	</dependencySets>
      </assembly>
      

      fileSets/fileSet/filtered 屬性為true時,表示在maven復制文件時,可以把maven的占位符替換成對應的值,比如需要打包文件中包含一個startup.bat文件,項目打包的源文件配置如下:

      @echo off
      title ${project.artifactId}-${project.version}-%date%-%time%-%cd%
      java -Dloader.debug=true -jar  ${project.artifactId}-${project.version}.jar
      

      項目打包后,輸出文件內容會改變成如下:

      rem 小游戲 地心俠士 by herbert
      @echo off
      title herbert.1.0.0-%date%-%time%-%cd%
      java -Dloader.debug=true -jar herbert-1.0.0.jar
      

      7. 項目啟動問題

      根據以上配置后,需要動態指定PropertiesLauncher的loader.path來加載分離后的lib,以及其他資源文件.這里提供兩個實用的方法

      1. 通過 java -D指定參數

        java -jar -Dloader.path=resources,lib,plugin hebert-1.0.0-SNAPSHOT.jar

      2. 在jar包同級目錄下創建loader.properties文件,并添加如下內容

        loader.path=resources,lib,plugin

      posted @ 2025-08-08 17:27  _herbert  閱讀(183)  評論(3)    收藏  舉報
      主站蜘蛛池模板: 亚洲天堂av日韩精品| 国产不卡一区不卡二区| 成人国产精品一区二区不卡| 天天综合天天添夜夜添狠狠添| 99久久精品国产一区二区暴力| 丁香婷婷综合激情五月色| 日韩精品一区二区av在线| 亚洲欧美日韩成人综合一区| 日韩有码国产精品一区| 韩国三级+mp4| 亚洲AV片一区二区三区| 色噜噜狠狠一区二区三区果冻| 日本丰满少妇裸体自慰| 在线看片免费人成视频久网| 亚洲日韩精品无码一区二区三区| av中文字幕一区二区| 亚日韩精品一区二区三区| 亚洲AVAV天堂AV在线网阿V| 最新日韩精品视频在线| 中文字幕国产在线精品| 中文字幕在线无码一区二区三区| 丝袜无码一区二区三区| 亚洲天堂视频网| 日韩有码中文在线观看| 9色国产深夜内射| 国产超高清麻豆精品传媒麻豆精品| mm1313亚洲国产精品| 欧美日韩国产一区二区三区欧| 久章草在线毛片视频播放| 国产麻豆一区二区精彩视频| 久久日产一线二线三线| 无码中文字幕人妻在线一区二区三区 | 成人午夜av在线播放| 欧美一本大道香蕉综合视频| 久草热大美女黄色片免费看| 两个人看的www免费视频中文| 国产伦一区二区三区久久| 无码人妻丝袜在线视频红杏| 中文字幕在线国产精品| 国产精品无遮挡一区二区| 中文字幕无码视频手机免费看|