1. 程式人生 > >maven 報錯invalid LOC header(bad signature)

maven 報錯invalid LOC header(bad signature)

在命令列中執行mvn package的時候報錯如下

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project bonus-notice-webapp: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\org\springframework\boot\spring-boot\1.4.2.RELEASE\spring-boot-1.4.2.RELEASE.jar時出錯; invalid LOC header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\org\springframework\boot\spring-boot-autoconfigure\1.4.2.RELEASE\spring-boot-autoconfigure-1.4.2.RELEASE.jar時出錯; invalid CEN header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\org\springframework\spring-core\4.3.4.RELEASE\spring-core-4.3.4.RELEASE.jar時出錯; invalid CEN header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\org\springframework\spring-context\4.3.4.RELEASE\spring-context-4.3.4.RELEASE.jar時出錯; invalid LOC header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.6\tomcat-embed-core-8.5.6.jar時出錯; invalid LOC header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\com\fasterxml\jackson\core\jackson-databind\2.8.4\jackson-databind-2.8.4.jar時出錯; invalid CEN header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\org\springframework\spring-web\4.3.4.RELEASE\spring-web-4.3.4.RELEASE.jar時出錯; invalid LOC header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\org\springframework\spring-beans\4.3.4.RELEASE\spring-beans-4.3.4.RELEASE.jar時出錯; invalid LOC header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\org\springframework\spring-webmvc\4.3.4.RELEASE\spring-webmvc-4.3.4.RELEASE.jar時出錯; invalid LOC header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\com\alibaba\dubbo\2.8.5\dubbo-2.8.5.jar時出錯; invalid LOC header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\org\apache\zookeeper\zookeeper\3.4.8\zookeeper-3.4.8.jar時出錯; invalid LOC header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\org\apache\velocity\velocity\1.7\velocity-1.7.jar時出錯; invalid CEN header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\com\minshenglife\minshenglife-framework-commons\2.0.2\minshenglife-framework-commons-2.0.2.jar時出錯; invalid LOC header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\org\apache\commons\commons-lang3\3.5\commons-lang3-3.5.jar時出錯; invalid LOC header (bad signature)
[ERROR] 錯誤: 讀取D:\dev-tool\maven-repository\io\netty\netty-all\4.0.36.Final\netty-all-4.0.36.Final.jar時出錯; invalid LOC header (bad signature)
[ERROR] [共 144 毫秒]
[ERROR] 15 個錯誤
[ERROR] -> [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/MojoFailureException

解決辦法
更改所用的IDE裡面的maven的使用者配置檔案
如果用的是eclipse,則在preferences裡面修改maven的settings.xml(增加私服倉庫), 編譯的時候,要用run as -- maven... -- 輸入package執行, 這樣就會編譯成功


如果用的是Intellij IDEA, 也是在settings裡面修改maven的配置檔案settings.xml(增加私服倉庫), 編譯的時候,在"maven projects"裡lifecycle選中“package”
,然後執行編譯。 這樣也會編譯成功。
如果直接在命令列裡,輸入mvn package,則執行的maven配置是系統的maven統一配置,不是當前需要的那個settings.xml(比如C:\dev\mvn\apache-maven-3.3.1\conf\mslife\msSettings.xml)
因此會報上面的錯誤。

IntelliJ IDEA操作介面如下