1. 程式人生 > >關於maven 執行install 報錯問題

關於maven 執行install 報錯問題

錯誤1

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32:32 min
[INFO] Finished at: 2018-09-13T16:08:48+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project api: Could not resolve dependencies for project

com.jhr:api:jar:1.0-SNAPSHOT: Could not transfer artifact org.springframework:spring-beans:jar:3.2.4.RELEASE from/to central (https://repo.maven.apache.org/maven2): GET request of: org/springframework/spring-beans/3.2.4.RELEASE/spring-beans-3.2.4.RELEASE.jar from central failed: Read timed out -> [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/DependencyResolutionException

解決思路:
先將parent工程(最外面的哪個)pom 先clean   --> 然後再 install
還不行,重啟一下idea,再clean - install

錯誤2

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project client: Could not resolve dependencies for project com.jhr:client:jar:1.0-SNAPSHOT: Could not find artifact

com.jhr:dubbotest:jar:1.0-SNAPSHOT -> [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/DependencyResolutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :client

出錯情況:

在對parent工程(最外面的哪個)pom 先clean,後install時,發現parent的pom依賴 子模組,install parent的時候出現 找不到 子模組;而子模組進行install時出現錯誤,無法執行;


原因:子模組與父工程 的dependency出現錯誤

解決思路:重新檢查各個模組的dependency是否出現錯誤,並修改

例如: 我的專案的相關依賴關係為   服務者與消費者 都依賴於 api模組,

但出錯的原因變成:服務者與消費者 都依賴於父工程,而父工程進行install時需先將子模組先進行install;所以出現死迴圈。