maven 可执行jar maven-shade-plugin
Posted tonggc1668
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven 可执行jar maven-shade-plugin相关的知识,希望对你有一定的参考价值。
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.2.1</version> <configuration> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.RSA</exclude> </excludes> </filter> </filters> <minimizeJar>true</minimizeJar> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <!-- Refer to: https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#AppendingTransformer 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. For example the spring-context-5.0.7.RELEASE.jar and spring-aop-5.0.7.RELEASE.jar both have spring.handlers. The spring aop jar‘s content is http://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler The spring context jar‘s content is http://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler http://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler http://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler http://www.springframework.org/schema/cache=org.springframework.cache.config.CacheNamespaceHandler With the AppendingTransformer they can be consolidated into one spring.handlers. Without AppendingTransformer, the former jar‘s handlers will be overwritten. In that case, some flow/topology submission will fail. --> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.citi.simpliciti.tempest.g10.util.TestMongo</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>
以上是关于maven 可执行jar maven-shade-plugin的主要内容,如果未能解决你的问题,请参考以下文章