天天看點

Eclipse中mvn install 報錯error in opening zip file

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:Failure executing javac, but could not parse the error:**.jar時出錯; error in opening zip file

該問題多為jar包錯誤,删除重下載下傳即可解決

報錯資訊

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project wms: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR] 錯誤: 讀取C:\Users\Administrator\.m2\repository\net\sf\jasperreports\jasperreports\4.7.1\jasperreports-4.7.1.jar時出錯; error in opening zip file
........................................................................      

解決方案

删除倉庫中該報錯包(此項目中是jasperreports-4.7.1.jar),重新下載下傳即可解決。

補充:若是maven沒有權限導緻下載下傳的jar不完整,需要檢查并修改配置檔案後重新下載下傳或者直接手動下載下傳完整包放在指定目錄下。

問題分析

1.如果出現“ error in opening zip file”這樣的錯誤,多半是這個包下載下傳得有問題;倉庫中雖然有jar檔案,但是用解壓軟體是會報錯的,建議删除重試。

2.另外maven有時會有這種情況也會報上面的錯誤:倉庫設定了使用者名密碼,但是maven沒有配置,正常情況maven應該提示沒有權限,但有時maven不提示而直接下載下傳jar,下載下傳到一半卻發現沒有權限,這時會導緻下載下傳的jar不完整。這種情況及時重新下載下傳仍有問題,需要修改maven配置檔案,或者幹脆手動下載下傳。