maven項目出現如下錯誤Could not calculate build plan

CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 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 org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to central (http://repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom..

出現這個錯誤因爲maven本地倉庫中缺少maven-resource-plugin:2.6這個相應的依賴文件。解決方法如下

在eclipse中找到maven項目下的pom.xml文件打開,並添加如下內容

<plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-resources-plugin</artifactId>
              <version>2.5</version>
</plugin>

打開dos命令控制檯,進入到maven項目的目錄(包含有pom.xml文件這一層級),然後選擇 maven install 回車後發現maven會自動下載缺失的文件。

下載完成後,在eclipse中右鍵maven項目-Maven-Update Project 勾選Force Update of Snapshots/Releases這個選項,點擊OK按鈕,發現錯誤已經消失。

問題解決。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章