2012-02-16 113 views
0

我「米開始使用Axis2的,從來沒有與它之前的工作。Axis2的使用Maven

的Maven是爲Axis2的樣品依賴於工作。我遵循正確的步驟,並已創建的環境變量並重新啓動Windows 7操作系統。

當試圖運行任何Axis2的樣品中,我得到這個錯誤信息:

cd C:\Apache\axis\samples\java_first_jaxws; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0_02" C:\\Apache\\maven\\bin\\mvn.bat 
The syntax of the command is incorrect. 
The syntax of the command is incorrect. 

ERROR: M2_HOME not found in your environment. 
Please set the M2_HOME variable in your environment to match the 
location of the Maven installation 

我有雙重檢查環境變量,它們是正確的有是竊聽我的事情。當我。按命令運行mvn --version返回我The syntax of the command is incorrect.並且此錯誤與不存在的POM文件相關。來自Axis2的所有樣本都有一個pom.xml文件。

由於這是我第一次接觸Java,我認爲這是一個容易解決的問題。

在此先感謝您的幫助。

編輯

運行此: cd /d C:\Apache\axis\samples\java_first_jaxws and then mvn install

結果: [ERROR] Unknown lifecycle phase "pom.xml". You must specify a valid lifecycle ph ase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin- artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate , initialize, generate-sources, process-sources, generate-resources, process-res ources, compile, process-classes, generate-test-sources, process-test-sources, g enerate-test-resources, process-test-resources, test-compile, process-test-class es, test, prepare-package, package, pre-integration-test, integration-test, post -integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-si te, site, post-site, site-deploy. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit ch. [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 rea d the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhase NotFoundException

回答

0
  • 是否使用某種Cygwin的外殼,或者你從某些網頁複製呢?如果使用普通的舊命令提示符,則粘貼的命令無效。
  • 在您的環境變量中設置JAVA_HOME,而不是在命令行上。
  • 將C:\ Apache \ maven \ bin添加到您的PATH環境變量中,以便您不必始終通過指定路徑來運行mvn
  • 在你的環境變量中設置M2_HOME,我想它應該是C:\ Apache \ maven \ bin。
+0

我有JAVA_HOME,M2_HOME和M2_HOME \ bin,根據Maven和Axis2的安裝指南,所有的環境變量都可以。當你說「或者你從一些網頁上覆制這個」複製了什麼? – Gerep 2012-02-16 12:45:08

+0

@Gerep:如果您運行命令提示符並運行'set',是否顯示所有變量?另外,我在說你發佈的命令('cd ;「variable = something」mvn') - 這是Windows shell的非法表達式,因此整個「命令的語法不正確。」) – JBert 2012-02-16 14:19:54

+0

about( 'cd ;「variable = something」mvn「),它是由NetBeans7生成的...並且是...'set'命令返回項目運行所需的所有變量... – Gerep 2012-02-16 14:25:12

2

我在Windows XP中看到了Maven 3.0的這個錯誤信息。對我而言,當我用引號括住M2_HOME變量時,我看到了錯誤。

M2_HOME="C:\..." 

但是,當我刪除引號時,錯誤消失。

M2_HOME=C:\... 

我不需要引號,因爲路徑中沒有空格。當路徑中存在空格時,可能需要引號,但我沒有對此進行測試。

而且僅供參考,我通過從mvn.bat開始刪除@echo off指令來調試該問題。當在另一對引號內引用M2_HOME變量時,問題似乎就會發生。

+0

這解決了我的問題。安裝所需的配置垃圾的數量令人難以置信。雙擊和安裝發生了什麼事情。 – ivymike 2014-02-26 16:44:02