键入所需库的存档:无法读取项目'starter'中的spring-core-4.0.1.RELEASE.jar'或该文件不是有效的ZIP文件 [英] Type Archive for required library: spring-core-4.0.1.RELEASE.jar' in project 'starter' cannot be read or is not a valid ZIP file

查看:335
本文介绍了键入所需库的存档:无法读取项目'starter'中的spring-core-4.0.1.RELEASE.jar'或该文件不是有效的ZIP文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse(STS 3.4)中导入Spring Initializr生成的压缩项目压缩的项目时,出现错误

While importing Spring Starter zipped project generated by Spring Initializr in Eclipse (STS 3.4) I got error

所需库的类型存档:项目中的'C:/Users/user/.m2/repository/org/springframework/spring-core/4.0.1.RELEASE/spring-core-4.0.1.RELEASE.jar' 'starter'无法读取或不是有效的ZIP文件

Type Archive for required library: 'C:/Users/user/.m2/repository/org/springframework/spring-core/4.0.1.RELEASE/spring-core-4.0.1.RELEASE.jar' in project 'starter' cannot be read or is not a valid ZIP file

是Eclipse问题,还是spring-core-4.0.1.RELEASE.jar有什么特别之处? 它的大小是979016B.

Is it Eclipse problem or is there something special about spring-core-4.0.1.RELEASE.jar ? Its size is 979016B.

更新:尝试将 https://stackoverflow.com/a/20093533/482717 答复为Eclipse Maven错误:在项目无法读取或不是有效的ZIP文件

运行mvn package -U

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project demo: Compilation failure: Compilation failure:
[ERROR] 读取C:\Users\weibl\.m2\repository\org\springframework\spring-context\4.0.1.RELEASE\spring-context-4.0.1.RELEASE.jar时出错; invalid LOC header (bad signature)
[ERROR] 读取C:\Users\weibl\.m2\repository\org\springframework\spring-aop\4.0.1.RELEASE\spring-aop-4.0.1.RELEASE.jar时出错; invalid LOC header (bad signature)
[ERROR] 读取C:\Users\weibl\.m2\repository\org\springframework\spring-beans\4.0.1.RELEASE\spring-beans-4.0.1.RELEASE.jar时出错; invalid CEN header (bad signature)
[ERROR] 读取C:\Users\weibl\.m2\repository\org\springframework\spring-expression\4.0.1.RELEASE\spring-expression-4.0.1.RELEASE.jar时出错; invalid LOC header (bad signature)
[ERROR] 读取C:\Users\weibl\.m2\repository\ch\qos\logback\logback-core\1.1.0\logback-core-1.1.0.jar时出错; invalid CEN header (bad signature)
[ERROR] 读取C:\Users\weibl\.m2\repository\org\springframework\spring-context\4.0.1.RELEASE\spring-context-4.0.1.RELEASE.jar时出错; cannot read zip file entry
[ERROR] 读取C:\Users\weibl\.m2\repository\org\springframework\spring-aop\4.0.1.RELEASE\spring-aop-4.0.1.RELEASE.jar时出错; cannot read zip file entry
[ERROR] /D:/Workspaces/workspace-sts-3.4.0.RELEASE/starter/src/main/java/demo/Application.java:[5,46] 程序包org.springframework.context.annotation不存在
[ERROR] /D:/Workspaces/workspace-sts-3.4.0.RELEASE/starter/src/main/java/demo/Application.java:[7,2] 找不到符号
[ERROR] 符号: 类 ComponentScan
[ERROR] /D:/Workspaces/workspace-sts-3.4.0.RELEASE/starter/src/main/java/demo/Application.java:[12,30] 无法访问org.springframework.context.ConfigurableApplicationContext
[ERROR] 找不到org.springframework.context.ConfigurableApplicationContext的类文件
[ERROR] -> [Help 1]

invalid LOC header (bad signature),但现在可以用于许多弹簧罐.

invalid LOC header (bad signature) but now for many spring jars.

D:\Workspaces\workspace-sts-3.4.0.RELEASE\starter>mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: D:\Progs\springsource\apache-maven-3.0.4\bin\..
Java version: 1.7.0_11, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_11\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
D:\Workspaces\workspace-sts-3.4.0.RELEASE\starter>

推荐答案

从本地存储库中删除相应的.jar文件,然后重新发出maven命令就可以了.似乎.jar文件在下载时损坏了.

Deleting the corresponding .jar files from local repository and reissuing the maven command did the trick. It seems the .jar files got corrupted while downloading.

这篇关于键入所需库的存档:无法读取项目'starter'中的spring-core-4.0.1.RELEASE.jar'或该文件不是有效的ZIP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆