Deploying Maven project throws java.util.zip.ZipException: invalid LOC header (bad signature)

前端 未结 14 2035
予麋鹿
予麋鹿 2020-11-22 08:03

I am getting the below exception when I run my mvn install. I have even deleted the local repository and ran again getting same exception.

<
14条回答
  •  一整个雨季
    2020-11-22 08:39

    The solution for me was to run mvn with -X:

    $ mvn package -X
    

    Then look backwards through the output until you see the failure and then keep going until you see the last jar file that mvn tried to process:

    ...
    ... <>
    ...
    [DEBUG] Processing JAR /Users/snowch/.m2/repository/org/eclipse/jetty/jetty-server/9.2.15.v20160210/jetty-server-9.2.15.v20160210.jar
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3.607 s
    [INFO] Finished at: 2017-10-04T14:30:13+01:00
    [INFO] Final Memory: 23M/370M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade (default) on project kafka-connect-on-cloud-foundry: Error creating shaded jar: invalid LOC header (bad signature) -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade (default) on project kafka-connect-on-cloud-foundry: Error creating shaded jar: invalid LOC header (bad signature)
    

    Look at the last jar before it failed and remove that from the local repository, i.e.

    $ rm -rf /Users/snowch/.m2/repository/org/eclipse/jetty/jetty-server/9.2.15.v20160210/
    

提交回复
热议问题