Eclipse導(dǎo)入maven項(xiàng)目時(shí),Pom.xml文件報(bào)錯(cuò)處理方法

? ? ? 導(dǎo)入maven項(xiàng)目,F(xiàn)Ile→Import→Existing Maven Projects→找到自己想要導(dǎo)入的文件目錄→Finish。項(xiàng)目就導(dǎo)入完成啦。接著就遇上了各種報(bào)錯(cuò)!!

一、Pom.xml文件第一次報(bào)錯(cuò)

CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-plugin-api:jar:2.0.9, org.apache.maven:maven-artifact:jar:2.0.9, org.apache.maven:maven-core:jar:2.0.9: Failure to transfer org.apache.maven:maven-plugin-api:jar:2.0.9 from https://repo.maven.apache.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:maven-plugin-api:jar:2.0.9 from/to central (https://repo.maven.apache.org/maven2): connect timed out。

解決方法:

這是因?yàn)榫W(wǎng)絡(luò)原因,導(dǎo)致文件沒有下載完成。

在電腦中搜索xxx.jar.lastUpdated,并將其都刪除即可,具體步驟如下:

1)找到 {user}/.m2/repository

2)搜索“.lastupdated”。(如果不記得對(duì)應(yīng)的.m2位置,可以全計(jì)算機(jī)搜索)Windows將展示所有文件夾的目錄。

3)選中對(duì)應(yīng)的lastupdated文件,并刪除。

4)重新打開(若先前未關(guān)閉,請(qǐng)關(guān)閉后重新打開)Eclipse,右鍵報(bào)錯(cuò)的項(xiàng)目,并選擇Maven > Update Project。同時(shí)記得勾選Force Update of Snapshots/Releases". 點(diǎn)擊OK,這樣就解決了依賴關(guān)系。

二、Pom.xml文件再次報(bào)錯(cuò)

[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format:or:[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/NoGoalSpecifiedException

解決方法:

右擊報(bào)錯(cuò)的項(xiàng)目→Properties→Project Facets→Runtimes→勾選Apache Tomcat v7.0

在Project Facets處找不到Runtimes時(shí),需要點(diǎn)擊下圖Convert to faceted from...

三、Pox.xml最后報(bào)錯(cuò)

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project mrpapp: Compilation failure

[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

解決方法:

在eclipse中找到Window → Preferences → Java → Installed JREs,在jRE home中修改為你安裝的jdk的目錄位置。

好了,3個(gè)報(bào)錯(cuò)都被處理了,現(xiàn)在我就可以開心的運(yùn)行項(xiàng)目啦!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,506評(píng)論 19 139
  • Spring Boot 參考指南 介紹 轉(zhuǎn)載自:https://www.gitbook.com/book/qbgb...
    毛宇鵬閱讀 47,253評(píng)論 6 342
  • 所有項(xiàng)目的構(gòu)建都是有生命周期的,這個(gè)生命周期包括:項(xiàng)目清理、初始化、編譯、測(cè)試、打包、集成測(cè)試、驗(yàn)證、部署、站點(diǎn)生...
    zlcook閱讀 2,995評(píng)論 0 21
  • 當(dāng)前,JVM生態(tài)圈主要的三大構(gòu)建工具: Apache Ant(帶著Ivy) Maven Gradle 對(duì)于剛開始接...
    清楓_小天閱讀 5,978評(píng)論 1 13
  • 一陣優(yōu)美的音樂從一扇白色大門里傳出,那扇白色門上有著七彩的音符,最頂端上用彩色的顏色寫著“都靈”閃爍著光芒。 ...
    南笙北箋閱讀 434評(píng)論 0 0

友情鏈接更多精彩內(nèi)容