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 ...
随机推荐
- spark性能优化(包括优化原理及基本方法)
https://www.jianshu.com/p/b8841a8925fb spark性能优化 1.诊断内存的消耗 2. 高性能序列化类库 3. 优化数据结构 4. 对多次使用的rdd进行持久化或者 ...
- yii在Windows下安装(通过composer方式)
Composer 安装: (Composer 不是一个包管理器,它仅仅是一个依赖管理工具.它涉及 "packages" 和 "libraries",但它在每个项 ...
- (转)淘淘商城系列——引用dubbo服务
http://blog.csdn.net/yerenyuan_pku/article/details/72758663 上文我们一起学习了如何发布一个dubbo服务,本文我就来教大家如何在web工程中 ...
- day21-5 类的多态与多态性
类的多态与多态性 多态 多态指的是一类事物有多种形态,如动物有多种形态:人.狗.猪 import abc class Animal(metaclass=abc.ABCMeta): # 同一类事物:动物 ...
- Win10上 visual studio设置为本地IIS运行网站时 必须以管理员身份加载项目的解决方法
右键,选择“兼容性疑难解答”. 选择“疑难解答程序” 选择“该程序需要附加权限” 点击测试程序 点击下一步 选择 是,为此程序保存这些设置
- weblogic启动 web应用ssh关闭 nohup命令
平时我们操作linux服务器的时候,都是通过ssh远程连接,然后启动服务器上的服务的,所以有时候启动weblogic,我们关闭ssh,weblogic 服务也相应的关闭了,那么我们就只能用nohup这 ...
- 笔试算法题(06):最大连续子数组和 & 二叉树路径和值
出题:预先输入一个整型数组,数组中有正数也有负数:数组中连续一个或者多个整数组成一个子数组,每个子数组有一个和:求所有子数组中和的最大值,要求时间复杂度O(n): 分析: 时间复杂度为线性表明只允许一 ...
- Map集合遍历的方式(以HashMap为例)
环境:jdk1.8 HashMap的遍历方式有多种,下面将会一一列出. 首先我们先在HashMap中添加几个键值对. HashMap<Integer, String> map = new ...
- <Redis> 入门五 持久化RBD/AOF
RDB RDB持久化是指在指定的时间间隔内将内存中的数据集快照写入磁盘(默认是 dump.rdb). 默认持久化机制,就是将内存中的数据以快照的方式写入二进制文件dump.rbd中. 触发快照的条件 ...
- Windows——bat中的路径和工具栏运行bat的坑
工具栏添加的批处理环境 编写一个简单的批处理文件 set testEnv = %cd% pause 这里第一句:设置当前文件夹路径为环境变量testEnv的值 这里第二句:暂停命令窗口 第一次我们直接 ...