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

前端 未结 14 1891
予麋鹿
予麋鹿 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:49

    Maybe unrelated to the original reason in this question, but for those who would face same with gradle and local module dependency

    dependencies {
        checkstyle project(":module")
    }
    

    this error could happen, if module doesn't contain group and version, so in the module/build.gradle just need to be specified

    plugins {
        id 'java-library'
    }
    
    group = "com.example"
    version = "master-SNAPSHOT"
    
    0 讨论(0)
  • 2020-11-22 08:50

    From gsitgithub/find-currupt-jars.txt, the following command lists all the corrupted jar files in the repository:

    find  /home/me/.m2/repository/ -name "*jar" | xargs -L 1 zip -T | grep error | grep invalid
    

    You can delete the corrupted jar files, and recompile the project.

    Example output:

    warning [/cygdrive/J/repo/net/java/dev/jna/jna/4.1.0/jna-4.1.0.jar]:  98304 extra bytes at beginning or within zipfile
      (attempting to process anyway)
    file #1:  bad zipfile offset (local header sig):  98304
      (attempting to re-compensate)
    zip error: Zip file invalid, could not spawn unzip, or wrong unzip (original files unmodified)
    
    0 讨论(0)
提交回复
热议问题