How maven2 and maven3 coexist

Source: Internet
Author: User

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:

    1. Change MVN. BAT and mvndebug. BAT to mvn3.bat and mvndebug3.bat respectively.
    2. 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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.