简体   繁体   中英

Installing maven on windows 7 64bit

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?

  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

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"

I had the same issue but was able to fix it.

When I set up maven_home , I had a semi-colon ; at the end. So when I set up path it become MAVEN;\\bin ... . I removed the semi-colon ; at the end and problem solved.

For some reason the ; does not matter in Windows XP, but is a problem in Windows7 (32 bit).

Nathan

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).

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

您必须将包含mvn可执行文件的目录添加到PATH环境变量中。

  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!)

I faced with this problem when use maven 3.3.3. Then tried with maven 3.3.9, it worked! Solution is download new version of maven.

Solved my issue by doing the following:

  1. As per Maven [Install] section page, It says: "Extract distribution archive in any directory". So extracted files in G: drive and hence this was the cause root.

  2. Shifted the downloaded folder to C: drive solved my issue

  3. Updated environment variables. Closed and re-open the command prompt.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM