2020年12月13日星期日

maven-shade-plugin~打包时过滤项目中某些包

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>








原文转载:http://www.shaoqun.com/a/498809.html

白色清关:https://www.ikjzd.com/w/1410

笨鸟转运:https://www.ikjzd.com/w/1550

淘粉吧:https://www.ikjzd.com/w/1725


maven-shade-plugin可以用来进行打包,并实现在打包过程中的一些过滤、排除、包含、重命名等一系列操作,当我们设计公用项目时,有时在项目时会有一些测试用例,如果在打包时想把这些测试包排除,使用maven-shade-plugin插件是个不错的选择。打包包含和排除下面的代码实现了以下几个功能:打包时排除com.lind.uaa.jwt.three包下的所有内容打包时排除项目的proper
grab:grab
custommade:custommade
Outlet Deals是什么?亚马逊Outlet Deals与LD、BD有什么区别?:Outlet Deals是什么?亚马逊Outlet Deals与LD、BD有什么区别?
品牌备案消失了?亚马逊卖家被大量波及:品牌备案消失了?亚马逊卖家被大量波及
关于珠海旅游,有什么好玩的景点,酒店?:关于珠海旅游,有什么好玩的景点,酒店?

没有评论:

发表评论