1. 程式人生 > >Java-Eclipse匯入maven專案時,Pom.xml檔案報錯處理方法

Java-Eclipse匯入maven專案時,Pom.xml檔案報錯處理方法

匯入maven專案,FIle→Import→Existing Maven Projects→找到自己想要匯入的檔案目錄→Finish。專案就匯入完成啦。接著就遇上了各種報錯!!

一、Pom.xml檔案第一次報錯

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。

解決方法:

這是因為網路原因,導致檔案沒有下載完成。

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

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

2)搜尋“.lastupdated”。(如果不記得對應的.m2位置,可以全計算機搜尋)Windows將展示所有資料夾的目錄。

3)選中對應的lastupdated檔案,並刪除。

4)重新開啟(若先前未關閉,請關閉後重新開啟)Eclipse,右鍵報錯的專案,並選擇Maven > Update Project。同時記得勾選Force Update of Snapshots/Releases”. 點選OK,這樣就解決了依賴關係。


二、Pom.xml檔案再次報錯

[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

解決方法:

右擊報錯的專案→Properties→Project Facets→Runtimes→勾選Apache Tomcat v7.0

在Project Facets處找不到Runtimes時,需要點選下圖Convert to faceted from…







三、Pox.xml最後報錯

[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個報錯都被處理了,現在我就可以開心的執行專案啦!


相關推薦

Java-Eclipse匯入maven專案Pom.xml檔案處理方法

匯入maven專案,FIle→Import→Existing Maven Projects→找到自己想要匯入的檔案目錄→Finish。專案就匯入完成啦。接著就遇上了各種報錯!!一、Pom.xml檔案第一次報錯CoreException: Could not get the

建立的maven專案pom.xml檔案解決方法

eclipse建立的maven專案,pom.xml檔案報錯解決方法 【錯誤原因一:】maven 編譯級別過低 【解決辦法:】 使用 maven-compiler-plugin 將 maven 編譯級別改為 jdk1.6 以上: <!-- java編譯外掛

eclipse匯入新的maven專案pom.xml第一行:解決辦法

eclipse匯入新的maven專案時,pom.xml第一行報錯: org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache.maven.archiver.Mav

myeclipse 匯入maven專案pom.xml檔案解決方法

問題:在匯入專案過程載入pom.xml檔案時錯誤資訊:No marketplace entries found to handle maven-compiler-plugin:3.3:compile i

maven專案中dubbo的xml檔案 dubbo.xsd檔案下載

maven專案中dubbo的xml檔案報錯,需要引入dubbo.xsd檔案問題在於Eclipse沒有識別出相應的標籤,解決辦法如下:1、選擇elcipse的window-->preferences,彈出相應對話方塊,選擇xml catalog 選擇add;2、 彈出的對

eclipse新建maven的web專案pom.xml的war解決方法/pom.xml將jar直接修改為war解決方法

步驟一 在pom.xml中的(若有)裡面新增外掛,沒有就直接複製一下程式碼。 <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</group

Java ee建立Maven專案路徑下沒有src/main/java等路徑只有src/main/resource

最近建立新Maven專案時發現有時候路徑下只有src/main/resource的路徑,缺失了重要的src/main/java 就像這樣,雖然自己可以再新建資料夾改名,但總感覺這樣不太好 網上查詢資料發現有兩種方法,第二種是後來發現的一步操作更簡單 先說第一種方法 1.右鍵單擊

匯入maven專案包不存在導致出錯的問題。

將maven專案匯入到eclipse中時,如果出現pom.xml中很多依賴的包都不存在時,可以在命令提示符視窗中1.cd到此專案所在的路徑下,2.然後,輸入 mvn clean install.   這樣就可以載入一些不存在的包。如果做完之後還是存在一些不存的包,可以自行下

eclipse新建maven專案jsp介面

新建maven專案時jsp介面報The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

解決eclipse新建maven專案 pom.xml 檔案問題

可能是由於maven預設是訪問一個外網的壓縮包倉庫,連線很慢所以導致出錯 ,在自己的倉庫配置檔案 settings.xml 中配置如下<mirror>  <id>alimaven</id>      <mirrorOf>cent

Eclipse建立maven專案出現Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources

Could not calculate build plan: Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from http://repo1.maven.org/maven2 was cached

IDEA 匯入Maven專案主類Main 右鍵沒有Run Application.無法執行而且cannot resolve symbol解決辦法。

Unsupported major.minor version 51.0  java.lang.UnsupportedClassVersionError: org/apache/maven/artifact/handler/ArtifactHandler : Unsuppor

使用STS建立springboot專案pom.xml檔案org.apache.maven.archiver.MavenArchiver.getManifest

首先我的STS版本時:3.7.3 解決辦法:->help->Install New Software -> add->location ->輸入: http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-mave

Maven專案pom.xml檔案以及專案編譯錯誤

pom.xml報錯:Referenced file contains errors (http://maven.apache.org/maven-v4_0_0.xsd). For more infor

maven工程pom.xml檔案:系統找不到指定的路徑

昨天專案正常執行且沒做任何操作,今天早上開啟遇到這個問題的小夥伴不要驚慌,可能是eclipse沒識別出pom.xml的標頭檔案。 錯誤樣式:H:\workspace\myproject\target\classes\META-INF\MANIFEST.MF (系統找不到指定

eclipse匯入maven專案pom檔案解決辦法

Project build error: Non-resolvable parent POM for com.example:demo:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:sprin

eclipse導入新的maven項目pom.xml第一行

hive maven software otto 解決 log n) ani conf eclipse導入新的maven項目時,pom.xml第一行報錯: org.apache.maven.archiver.MavenArchiver.getManifest(org.apa

Eclipse匯入Maven專案pom.xml的解決辦法

Maven是基於專案物件模型,可以通過一小段描述資訊來管理專案的構建,報告和文件的軟體專案管理工具。如今用到Maven的地方很多,而在用Eclipse開發專案時經常匯入Maven專案時出現此類錯誤,在這

eclipse匯入maven專案有紅叉及pom.xml出錯的問題的解決

匯入我們的專案的時候總會出現很多紅叉,看著很難受,其實可以解決的 解決方法: 1、先build project,然後右鍵專案->maven->update project pom還是有問題就到這個目錄,開啟命令列,mvn clean->mvn eclipse:clean-&

eclipse匯入maven專案的設定以及匯入後有紅色感嘆號

(1)在windows->Preferences->Build Path->Classpath Variable裡,把mvn庫匯入,命名必須叫“M2_REPO”,選擇的目錄一般是類似於“/home/Potter/.m2/repository” (2)