部署Maven项目引发java.util.zip.ZipException:无效LOC标头

部署Maven项目引发java.util.zip.ZipException:无效LOC标头(错误签名)

运行我的mvn install..我甚至删除了本地存储库,并再次运行,得到了相同的异常。

[错误]未能在项目核心上执行目标org.apache.maven.plugins:maven-shade-plugin:2.1:shade(默认)-批处理:创建阴影JAR:无效loc标头(错误签名)->[帮助1]

<?xml version="1.0" encoding="UTF-8"?><plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-shade-plugin</artifactId>
   <version>2.1</version>
   <configuration>
      <skipTests>true</skipTests>
   </configuration>
   <executions>
      <execution>
         <phase>package</phase>
         <goals>
            <goal>shade</goal>
         </goals>
         <configuration>
            <artifactSet>
               <excludes>
                  <exclude>commons-logging:commons-logging:jar:*</exclude>
               </excludes>
            </artifactSet>
            <filters>
               <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                     <!-- workaround for a spring issues -->
                     <exclude>META-INF/*.SF</exclude>
                     <exclude>META-INF/*.DSA</exclude>
                     <exclude>META-INF/*.RSA</exclude>
                     <!-- don't want to pick up any other log4j.xml -->
                     <exclude>log4j.xml</exclude>
                  </excludes>
               </filter>
            </filters>
            <!-- May be needed to work around another issue in Spring -->
            <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>


尚方宝剑之说
浏览 697回答 3
3回答

回首忆惘然

你需要检查哪个罐子有问题。一定是坏了。删除该JAR并运行mvn spring-boot:run再次发号施令。可能有更多的JAR已经损坏,所以每次您需要运行该命令来删除该JAR时。在我的例子中,mysql,Jackson,方面Jars被破坏了。mvn spring-boot:run命令3次,我就弄清楚了这一点,并将JAR从.m2文件夹。现在这个问题已经解决了。

largeQ

主要问题是损坏的罐子。要找到损坏的一个,您需要添加一个Java异常断点在Eclipse的断点视图或首选IDE中,选择java.util.zip.ZipException类,并重新启动Tomcat实例。当JVM挂起时ZipException你必须去的断点JarFile.getManifestFromReference()在堆栈跟踪中,并检查属性。name查看文件名。之后,您应该从文件系统中删除该文件,然后右键单击您的项目,选择Maven,UpdateProject,检查Snaptings/Releases的ForceUpdate。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java