问题
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
- go to a dir IN the bin
- copy the address in the address bar(must end with bin)
- go to Start and type in "env"
- Select "edit the system evironment variables"
- find the PATH variable which must also have an existing value for Java as Maven needs Java.
- append a ; + paste the path.
- restart to update system
- run "mvn install" in the cli.
Yucca
回答2:
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"
回答3:
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
回答4:
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).
回答5:
You must add the directory containing the mvn executable to your PATH environment variable.
回答6:
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
回答7:
- Just set the system environment variable rather than user variable
- 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!)
回答8:
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.
回答9:
Solved my issue by doing the following:
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.
Shifted the downloaded folder to C: drive solved my issue
Updated environment variables. Closed and re-open the command prompt.
来源:https://stackoverflow.com/questions/7219628/installing-maven-on-windows-7-64bit