小編給大家分享一下maven在eclipse中的問題有哪些,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
成都服務(wù)器托管,成都創(chuàng)新互聯(lián)提供包括服務(wù)器租用、成都機(jī)柜租用、帶寬租用、云主機(jī)、機(jī)柜租用、主機(jī)租用托管、CDN網(wǎng)站加速、域名注冊等業(yè)務(wù)的一體化完整服務(wù)。電話咨詢:18982081108
Unrecognised tag
問題
由于我使用本地代理倉庫,所以settings.xml設(shè)置如下:
<profiles> <profile> <id>nexus</id> <repositories> <repository> <id>nexus</id> <name>Nexus</name> <url>http://localhost:8081/nexus/content/groups/public</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus</id> <name>Nexus</name> <url>http://localhost:8081/nexus/content/groups/public</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> <!--激活配置--> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> </profiles>
但在Maven編譯時(shí)報(bào)了如下異常:
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'activeProfiles' (position: START_TAG seen ...\n\t... @269:18) @ C:\Documents and Settings\Administrator.ZQFGROUP.000\.m2\settings.xml, line 269, column 18
[WARNING]
解決
這是因?yàn)殄e(cuò)把a(bǔ)ctiveProfiles配置到了profiles節(jié)點(diǎn)里了,應(yīng)該把a(bǔ)ctiveProfiles移到profiles之外,更多settings.xml配置信息請參考這里。
No goals
問題
Eclipse安裝了Maven插件后,在項(xiàng)目的pom.xml上右鍵能看到如下:
而我自作聰明地認(rèn)為:Maven build 與 mvn compile 是等價(jià)的,于是我再點(diǎn)擊"Maven build..."之后,“Goals”是空的,如:
于是就報(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-site, site, post-site, site-deploy, pre-clean, clean, post-clean. -> [Help 1]
解決
解決方法至少有兩種:
再點(diǎn)擊"Maven build..."之后,輸入你要執(zhí)行的“Goals”,如compile,clean,test等等;
在pom.xml中配置默認(rèn)的Goal,如:
<build> <defaultGoal>clean</defaultGoal> </build>
作為project的子節(jié)點(diǎn)。
not a JRE
問題
在使用pom.xml配置默認(rèn)Goal的時(shí),如果默認(rèn)的Goal為clean就沒問題,但如果是如:
就會(huì)報(bào)錯(cuò)誤:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project Demo: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre7\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.
經(jīng)過幾番嘗試,才發(fā)現(xiàn)并不是多個(gè)Goal的問題,而是compile Goal的問題。但使用命令的"mvn compile"又是OK的。
幾經(jīng)折騰才發(fā)現(xiàn)錯(cuò)誤里說的很清楚:Please ensure you are using JDK 1.4 or above and not a JRE",它需要的是JDK而不是JRE。我給的項(xiàng)目中使用的是公共JRE:
解決
修改Eclipse的配置,使用JDK:Eclipse->Window->Preferences->Java->Installed JREs
system propery is not set
錯(cuò)誤:-Dmaven.multiModuleProjectDirectory system propery is not set.
新建一個(gè)環(huán)境變量M2_HOME指向你的maven安裝目錄
M2_HOME=D:\study\apache-maven-3.3.3
然后在Window->Preference->Java->Installed JREs->Edit
在Default VM arguments中設(shè)置
-Dmaven.multiModuleProjectDirectory=$M2_HOME

5. Launching New_configuration
項(xiàng)目上右擊->Run/Debug Settings->刪除 new_Configuration.
以上是“maven在eclipse中的問題有哪些”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
本文標(biāo)題:maven在eclipse中的問題有哪些
瀏覽地址:http://chinadenli.net/article44/gsjdee.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、關(guān)鍵詞優(yōu)化、品牌網(wǎng)站制作、外貿(mào)建站、軟件開發(fā)、網(wǎng)頁設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
移動(dòng)網(wǎng)站建設(shè)知識(shí)