maven的pom.xml第一行報錯以及ArtifactTransferException: Could not transfer artifact.....和 CoreException...的問題


之前還好好的,今天打開后,就報了很多錯誤,而且都類似,如下:

1)ArtifactDescriptorException: Failed to read artifact descriptor for log4j:log4j:jar:1.2.17: ArtifactResolutionException: Failure to transfer log4j:log4j:pom:1.2.17 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact log4j:log4j:pom:1.2.17 from/to central (http://repo1.maven.org/maven2): The operation was cancelled.   pom.xml /face   line 1  Maven Dependency Problem
(2)ArtifactTransferException: Could not transfer artifact com.baidu.aip:java-sdk:jar:4.5.0 from/to central (http://repo1.maven.org/maven2): Write error pom.xml /face   line 22 Maven Dependency Problem
(3)ArtifactTransferException: Could not transfer artifact org.json:json:jar:20160810 from/to central (http://repo1.maven.org/maven2): invalid version format: 1 pom.xml /face   line 1  Maven Dependency Problem


查了一下,發現,原來由於網絡等原因,相應的jar包沒有抓下來,生成了很多 *.lastUpdated 為后綴的文件,以於是根據報錯提示,來到本地倉庫中,找到報錯的文件,點進去后發現真的沒有jar包,只有 *lastUpdated 為后綴的文件,刪了之后,果然錯誤減少了不少,但卻變成了第一行報錯:

ArtifactTransferException: Could not transfer artifact org.json:json:jar:20160810 from/to central (http://repo1.maven.org/maven2): invalid version format: 1    pom.xml /face   line 1  Maven Dependency Problem



這是由於其他地方也有 *lastUpdated 為后綴的文件,一個一個刪不科學,只需在cmd下,進入到本地倉庫的目錄中,執行此命令,復制粘貼即可:for /r %i in (*.lastUpdated) do del %i
它會自動刪除一切 *lastUpdated 為后綴的文件

然后,更新maven項目,如圖,我在myeclipse更新我的maven項目后,錯誤全部消除

這里寫圖片描述

最新發現:下面這個異常也是上述原因造成,刪除 *lastUpdated 的文件后,更新項目,如上圖所示,如果有報錯沒有更新配置,則再更新項目配置,就在update dependencies下面。

 CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM