使用idea对maven项目打包时,报 invalid LOC header (bad signature)异常处理

打包,报错:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

[INFO] Including org.codehaus.groovy:groovy-all:jar:2.4.3 in the shaded jar.

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 8.269 s

[INFO] Finished at: 2017-11-06T11:08:57+08:00

[INFO] Final Memory: 62M/644M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.4.3:shade (default) on project com.project.name: Error creating shaded jar: invalid LOC header (bad signature) -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

  

根据提示在项目目录下使用 mvn -X package 执行,则将详细堆栈信息打印出来:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

[DEBUG] Processing JAR H:\apache-maven-3.3.9\repository\org\apache\parquet\parquet-jackson\1.7.0\parquet-jackson-1.7.0.jar

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 43.299 s

[INFO] Finished at: 2017-11-06T11:35:18+08:00

[INFO] Final Memory: 33M/759M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.4.3:shade (default) on project com.project.name: 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:2.4.3:shade (default) on project com.project.name: Error creating shaded jar: invalid LOC header (bad signature)

        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)

        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)

        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)

        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)

        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarte

  

看到最后一个DEBUG信息,找到对应目录" H:\apache-maven-3.3.9\repository\org\apache\parquet\parquet-jackson\1.7.0\",发现以.sha1-in-progress结尾的文件,说明jar没有正常下载,删除重新执行,同时观察该目录即可:

使用idea对maven项目打包时,报 invalid LOC header (bad signature)异常处理_第1张图片

 

 

 再执行到这里时,提示如下:

 

 

说明正常下载了,对应目录:

使用idea对maven项目打包时,报 invalid LOC header (bad signature)异常处理_第2张图片

 

 

 已经正常。

(多说一句,如果发现进度条走了一半不走了,可以停掉删除重新来;另外,国内用aliyun的maven库要快很多)

 

总结:出现invalid LOC header (bad signature)时,按提示带上-X执行mvn找到,.sha1-in-progress删除,重新执行即可。

你可能感兴趣的:(使用idea对maven项目打包时,报 invalid LOC header (bad signature)异常处理)