当我跑mvn -v
时,我没有获得该版本。我得到了以下
C:\>mvn -v
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
......
我相信我设置了正确的路径。这是路径
C:\>path
PATH=C:\java7\bin;C:\maven\apache-maven-3.3.3\bin
C:\>echo %JAVA_HOME%
C:\java7
C:\>java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build pwa6470sr8fp10-20141219_01(SR8 FP10))IBM J9 VM (build 2.6, JRE 1.7.0 Windows 7 amd64-64 Compressed References 20141216_227497 (JIT enablebled)
知道我做错了吗?
答案 0 :(得分:0)
设置以下环境变量。它对我来说就像一个魅力。
JAVA_HOME - C:\Program Files\Java\jdk1.7.0
M2_HOME- D:\java\apache-maven-3.1.0-bin\apache-maven-3.1.0
path- C:\Program Files\Java\jdk1.7.0\bin;D:\java\apache-maven-3.1.0-bin\apache-maven-3.1.0\bin;
MAVEN_HOME -D:\java\apache-maven-3.1.0-bin\apache-maven-3.1.0
在命令提示符中检查 mvn -v 。
C:\>mvn -v
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 07:45:32+0530)
Maven home: D:\java\apache-maven-3.1.0-bin\apache-maven-3.1.0
Java version: 1.7.0, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
C:\>
答案 1 :(得分:0)
你有类型
mvn.cmd
为了使其正常工作
答案 2 :(得分:-1)
在命令提示符中添加M2_HOME变量。
M2_HOME = C:\行家\ Apache的行家-3.3.3 \ bin中 PATH = C:\ java7 \ BIN;%M2_HOME%