2014-02-10 22 views
5

在Eclipse(STS 3.4)中導入Spring Starter zipped project generated by Spring Initializr時,出現錯誤類型爲所需庫存檔:項目'starter'中的spring-core-4.0.1.RELEASE.jar'無法讀取或不是有效的ZIP文件

類型存檔所需的庫:「C:/Users/user/.m2/repository/org/springframework/spring-core/4.0.1.RELEASE/spring-core-4.0.1.RELEASE.jar 'in project'starter'無法讀取或不是有效的ZIP文件

是Eclipse的問題還是有什麼特別的關於spring-core-4.0.1.RELEASE.jar? 它的大小是979016B。

更新:試圖回答https://stackoverflow.com/a/20093533/482717eclipse maven error: Archive for required library in project cannot be read or is not a valid ZIP file

當運行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)但現在許多春瓶。

回答

4

從本地存儲庫中刪除相應的.jar文件並重新發布maven命令的確有竅門。看起來.jar文件在下載時被損壞。

相關問題