maven打包插件maven-shade-plugin简单介绍
作用:
1、可以把依赖打入jar包,然后直接使用这个jar包,从而不用担心依赖问题
2、通过设置MainClass,创建一个可以执行的jar包
3、Java工程经常会遇到第三方 Jar 包冲突,使用 maven shade plugin 可以解决 jar 或类的多版本冲突。 maven-shade-plugin 在打包时,可以将项目中依赖的 jar 包中的一些类文件打包到项目构建生成的 jar 包中,在打包的时候把类重命名
3、Resource Transformers可以对多个依赖包的冲突内容进行处理
Merging Content of Specific Files with AppendingTransformer, XmlAppendingTransformer and ResourceBundleAppendingTransformer
Some jars contain additional resources (such as properties files) that have the same file name. To avoid overwriting, you can opt to merge them by appending their content into one file. One good example for this is when aggregating both the spring-context and plexus-spring jars. Both of them have the META-INF/spring.handlers file which is used by Spring to handle XML schema namespaces. You can merge the contents of all the files with that specific name using the AppendingTransformer as shown below:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
这篇文章的主要目的是:在做dubbo的jmeter压测的时候,你只需要把所有的依赖包打到dubbo-consumer的jar包里去,这样把这个唯一的jar包放入lib/ext下就可以了
1、https://www.jianshu.com/p/7a0e20b30401
2、https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#AppendingTransformer
maven打包插件maven-shade-plugin简单介绍的更多相关文章
- maven打包插件详解
maven-jar-plugin插件的使用及详解 该插件的xml配置及详解如下: <plugin> <groupId>org.apache.maven.plugins</ ...
- 有时间研究一下Maven打包插件细节
Maven工作分为多个阶段,具体阶段参考:https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html ...
- maven打包插件
如何把依赖的jar包中的资源抽到当前jar中 maven-compiler-plugin:编译插件,可指定资源jdk版本,前提是当前代码使用的jdk版本 大于或等于 source maven-asse ...
- 在cmd命令行使用Maven Archetype插件 generate命令创建简单的java web项目
前提: 1.下载apache-maven:https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache ...
- maven打包插件maven-assembly-plugin
1.POM文件添加jar包生成插件 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifac ...
- Maven打包插件Assembly(七)
1. 在 dubbo 的 provider 项目(实现类项目dubbo-service-impl)中 pom.xml 配置 assembly插件信息 <!-- 指定项目的打包插件信息 --> ...
- Maven仓库—Nexus环境搭建及简单介绍
1. 环境搭建 1.1 下载 http://www.sonatype.org/nexus/ NEXUS OSS [OSS = Open Source Software,开源软件--免费] NE ...
- Maven仓库-Nexus环境搭建及简单介绍
1. 环境搭建 1.1 下载 http://www.sonatype.org/nexus/ NEXUS OSS [OSS = Open Source Software,开源软件——免费] NE ...
- springboot maven打包插件
<build> <plugins> <!-- springboot maven打包--> <plugin> <groupId>org.spr ...
随机推荐
- IMX6核心板系列解决方案-工业级|商业级|四核|双核|Plus核心板
i.MX 6Quad四核商业级和工业级系列的应用处理器将可扩展平台与广泛的集成和高能效处理功能相结合,尤其适合多媒体应用.i.MX6 Quad处理器的特性包括: 满足操作系统和游戏的MIPS需求,增强 ...
- java.math.BigDecimal类multiply的使用
java.math.BigInteger.multiply(BigInteger val) 返回一个BigInteger,其值是 (this * val).声明 以下是java.math.BigInt ...
- C# html table转excel
1. protected void ebtDC_Click(object sender, EventArgs e) { string elxStr = "<table><t ...
- mysql事件【定时器】
一,借鉴[luo奔的蜗牛] 1.创建一张表 create table mytable ( id int auto_increment not null, name ) not null default ...
- 16.04 下 ufw 防火墙的的开启、禁用、开放端口、关闭端口
16.04 下的 ufw 防火墙相关操作使用ufw命令.通过ufw --help可以查看所有相关命令. 打开防火墙 sudo ufw enable 重启防火墙 sudo ufw reload 打开指定 ...
- vim common usage
vim normal模式下 1.c+i+分隔符,删除分隔符里面的内容(不删除分隔符,c+a+分隔符则包括分隔符一起删掉) 如将光标位于'%s : %d years old ' 中,此时按c+i+' ...
- pytorch: Variable detach 与 detach_
pytorch 的 Variable 对象中有两个方法,detach和 detach_ 本文主要介绍这两个方法的效果和 能用这两个方法干什么. detach 官方文档中,对这个方法是这么介绍的. 返回 ...
- 洛谷——P4053 [JSOI2007]建筑抢修
P4053 [JSOI2007]建筑抢修 小刚在玩JSOI提供的一个称之为“建筑抢修”的电脑游戏:经过了一场激烈的战斗,T部落消灭了所有z部落的入侵者.但是T部落的基地里已经有N个建筑设施受到了严重的 ...
- 笔试算法题(40):后缀数组 & 后缀树(Suffix Array & Suffix Tree)
议题:后缀数组(Suffix Array) 分析: 后缀树和后缀数组都是处理字符串的有效工具,前者较为常见,但后者更容易编程实现,空间耗用更少:后缀数组可用于解决最长公共子串问题,多模式匹配问题,最长 ...
- 使用maven的mybatis-generator代码生成器插件生成实体类、mapper配置文件和mapper接口(使用idea)
接着之前创建的ssmMaven项目 一: 在pom文件中加入mybatis-generator插件 <plugins> <plugin> <groupId>org. ...