Some projects are usually compiled with maven2, and some must be maven3, so maven2.2.1 and maven3.0.x are always on my machine.
: Http://maven.apache.org/download.cgi 2.2.1 3.0.5
Both maven2 and maven3 need to set the PATH environment variable in the bin directory. The command names are MVN or mvndebug. Therefore, the installation of both versions conflicts.
A simple coexistence method is to modify the startup script under the bin of maven3:
- Change MVN. BAT and mvndebug. BAT to mvn3.bat and mvndebug3.bat respectively.
- When the two scripts are started, the system checks whether MVN. Bat exists. Therefore, open the two text files, locate MVN. bat, and change it to mvn3.bat.
Then re-open the CMD command line and enter MVN-version and mvn3-version. Then you can see that these two commands correspond to different Maven versions:
C: \ Users \ KK>MVN-version
Apache Maven 2.2.1(R801777; 03:16:01 + 0800)
Java version: 1.6.0 _ 37
Java home: D: \ Software \ Java \ JRE
Default locale: zh_cn, platform encoding: GBK
OS name: "Windows 7" version: "6.1" arch: "amd64" Family: "Windows"
C: \ Users \ KK>Mvn3-version
Apache Maven 3.0.4(R1232337; 16:44:56 + 0800)
Maven home: F: \ study \ open \ apache-maven-3.0.4 \ bin \..
Java version: 1.6.0 _ 37, vendor: Sun Microsystems Inc.
Java home: D: \ Software \ Java \ JRE
Default locale: zh_cn, platform encoding: GBK
OS name: "Windows 7", version: "6.1", arch: "amd64", family: "Windows"