<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>
原文地址:https://www.cnblogs.com/tonggc1668/p/10635365.html
时间: 2024-10-16 01:57:52