2012-02-16 42 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