maven-shade-plugin可以用來進行打包,并實作在打包程序中的一些過濾、排除、包含、重命名等一系列操作,當我們設計公用專案時,有時在專案時會有一些測驗用例,如果在打包時想把這些測驗包排除,使用maven-shade-plugin插件是個不錯的選擇,
打包包含和排除
下面的代碼實作了以下幾個功能:
- 打包時排除com.lind.uaa.jwt.three包下的所有內容
- 打包時排除專案的properties型別的組態檔
- 打包時,com.baomidou組織的包添加到當然JAR包里,默認是不會添加到當前包的
createSourcesJar選項實作了打包時為源代碼再打一個包
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<!-- 過濾器排除組態檔-->
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>**/*.properties</exclude>
<exclude>com/lind/uaa/jwt/three/**</exclude>
</excludes>
</filter>
</filters>
<artifactSet>
<!-- 捆綁包含,目標專案不需要再手動參考這個包了 -->
<includes>
<include>com.baomidou:*</include>
</includes>
</artifactSet>
<createSourcesJar>true</createSourcesJar>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/234135.html
標籤:其他
上一篇:Python刷題:集合S(k)求|x-y|最小時的x和y(二進制)
下一篇:一致性哈希看這篇就夠了!【轉】
