was cached in the local repository, resolution will not be reattempted until the update interval of fintech has elapsed or updates are forced


今天使用命令mvn compile編譯maven項目時提示錯誤信息,錯誤信息如下: 

[ERROR] Failed to execute goal on project <project_name>: Could not resolve dependencies for project com.xxx.xxx:<project_name>:jar:1.0.7: Failure to find com.xxx.xxx:obj-test-client:jar:1.1.1 in http://maven-nexus.xxx.com/repository/maven-public/ was cached in the local repository, resolution will not be reattempted until the update interval of fintech has elapsed or updates are forced -> [Help 1]

問題原因 :
Maven默認會使用本地緩存的庫來編譯工程,對於上次下載失敗的庫,maven會在~/.m2/repository/<group>/<artifact>/<version>/目錄下創建xxx.lastUpdated文件,一旦這個文件存在,那么在直到下一次nexus更新之前都不會更新這個依賴庫。

解決辦法:

刪除v~/.m2/repository/<group>/<artifact>/<version>/目錄下的*.lastUpdated文件,然后再次運行mvn compile編譯工程。

Jenkins構建時報錯:

通過jenkins編譯時報此錯,我的maven安裝目錄/opt/maven ,解決方法如下:

發現obj-test-client-1.1.1.jar下載到本地時失敗,從提示可知是本地倉庫的緩存(cached)造成,於是我刪除目錄/opt/maven/repo/<group>/obj-test-client/1.1.1后Jenkins重新構建(或在項目目錄 mvn 重新編譯)即可編譯成功! 

注意你要確定遠程倉庫中存在此jar(obj-test-client-1.1.1.jar)包 


免責聲明!

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



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