码迷,mamicode.com
首页 > 编程语言 > 详细

maven 可执行jar maven-shade-plugin

时间:2019-04-01 11:38:07      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:5.0   www.   some   pac   ack   date   package   test   filters   

<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

标签:5.0   www.   some   pac   ack   date   package   test   filters   

原文地址:https://www.cnblogs.com/tonggc1668/p/10635365.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!