maven 可执行jar maven-shade-plugin

<build>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.0.2</version>
        <configuration>
          <archive>
            <manifest>
              <mainClass>com.citi.simpliciti.tempest.g10.util.TestMongo</mainClass>
            </manifest>
            <manifestEntries>
              <Specification-Title>${project.name}</Specification-Title>
              <Specification-Version>${project.version}</Specification-Version>
              <Implementation-Version>${build.number}</Implementation-Version>
              <Change>${project.version}</Change>
              <Build-Date>${maven.build.timestamp}</Build-Date>
            </manifestEntries>
          </archive>
        </configuration>
      </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>
        </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.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>

 

转载于:https://www.cnblogs.com/tonggc1668/p/10635365.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值