Installing maven on windows 7 64bit

2019-01-11 18:12发布

I want to create a Tapestry Skeletion Project. I follow to these guide: http://maven.apache.org/download.html#Installation, http://juanjoefe.com/tutoriales/instalar-maven-en-windows-7/ and other guides on the internet.

But, when I type "mvn --version" or "mvn -version", I always receive error "mvn is not recognized as an internal or external command, operable program or batch file.

My friends use Windows 7 x86, and they had no problem. How can I install Maven 3.0.3 on Windows 7 x64?

8条回答
We Are One
2楼-- · 2019-01-11 19:00
  1. navigate in explorer to the Maven directory
  2. go to a dir IN the bin
  3. copy the address in the address bar(must end with bin)
  4. go to Start and type in "env"
  5. Select "edit the system evironment variables"
  6. find the PATH variable which must also have an existing value for Java as Maven needs Java.
  7. append a ; + paste the path.
  8. restart to update system
  9. run "mvn install" in the cli.

Yucca

查看更多
beautiful°
3楼-- · 2019-01-11 19:01

Setting up Maven 3.0.4 in Windows 7 64 bit

Right Click My Computer --> Properties --> Advanced System Properties --> Environment Variables --> System Variables

Click New

Add

M2_HOME=C:\maven\apache-maven-3.0.4

M2=%M2_HOME%\bin

Assuming JAVA_HOME is already setup.

Edit Path environment Variable and add %M2% as ;%M2% at the end of the existing path

example:

C:\Users\arun.bc\oraclexe\app\oracle\product\10.2.0\server\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Dell\DW WLAN Card;C:\Ruby193\bin;C:\Borland\BCC55\Bin;%JAVA_HOME%/bin;%M2%

Apply and Close the System Properties

Open a new command prompt and type

mvn --version

Following will be the message,

C:\Users\arun.bc>mvn --version
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: C:\maven\apache-maven-3.0.4
Java version: 1.7.0_03, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_03\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
查看更多
劳资没心,怎么记你
4楼-- · 2019-01-11 19:04
  1. Just set the system environment variable rather than user variable
  2. set the M2_HOME as: C:\Program Files\apache-maven-3.1.1 rather than : C:\Program Files\Apache Software Foundation\apache-maven-3.1.1 (I don't know why, but it seems that the space really matters!)
查看更多
家丑人穷心不美
5楼-- · 2019-01-11 19:06

You must add the directory containing the mvn executable to your PATH environment variable.

查看更多
地球回转人心会变
6楼-- · 2019-01-11 19:09

You can also have multiple Maven installations in your PATH like I do:

C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\glassfish3\jdk7\bin;C:\DEV\servers\apache-tomcat-7.0.5\bin;C:\Program Files (x86)\Java\jdk1.6.0_25\bin;C:\DEV\apache-maven-3.0.3\bin;C:\DEV\apache-maven-2.2.1\bin;C:\Program Files (x86)\Windows Live\Shared 

The first Maven bin (Maven 3), is used before my previous (Maven 2).

查看更多
女痞
7楼-- · 2019-01-11 19:15

Windows sort all variables by alphabet. Don't use multiple elements to construct path to maven like M2 for folder /bin and M2_HOME for root folder JUST take full path to \bin directory of maven and put it in the Path variable

查看更多
登录 后发表回答