maven-shade-plugin插件
Posted 太白的技术博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven-shade-plugin插件相关的知识,希望对你有一定的参考价值。
maven-shade-plugin主要是maven-assembly-plugin的后继者,用来将一个自启动jar项目的依赖打包到一个大的jar中,比如dubbo就是这么做的。具体可参考http://maven.apache.org/plugins/maven-shade-plugin/以及http://blog.csdn.net/defonds/article/details/43233131。基本为:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>1.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.RSA</exclude> </excludes> </filter> </filters> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.defonds.RsaEncryptor</mainClass> </transformer> <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>
以上是关于maven-shade-plugin插件的主要内容,如果未能解决你的问题,请参考以下文章
使用maven-shade-plugin插件解决spark依赖冲突问题
idea打包jar的多种方式,用IDEA自带的打包形式,用IDEA自带的打包形式 用Maven插件maven-shade-plugin打包,用Maven插件maven-assembly-plugin打