MAVEN Installation Best Practices (Windows platform)

Source: Internet
Author: User

First step: Download maven, unzip.

Download maven files on Maven's website, here i download "Apache-maven-2.2.1-bin.zip", if you need Maven source code, you can choose to download the "Src.zip" end of the distribution package. After the download is complete, unzip to the custom location.

Step Two: Set the environment variables.

There are three environment variables involved, namely "m2_home", "Path" and "maven_opts", which will be explained in step.

First, add the environment variable "M2_home", whose value is set to the location of the Maven file that was extracted in the first step, that is, MAVEN's installation path, for example, "D:\work\apache-maven-2.2.1".

Next, edit the environment variable "path" to add the Maven instructions folder to the path. Here, we refer to the "m2_home" environment variable we just defined and append ";%m2_home%\bin" at the end of the "path" content.

Finally, the environment variable "maven_opts" is added, and its value is generally set to "xms128m-xmx512m". This variable is not required, but the default memory usage may be insufficient to build a larger project.

Here, MAVEN is ready to use, try typing "mvn-v" in the command-line window with the output shown below.

Step three: Configure MAVEN within the user scope.

By default, MAVEN uses a configuration file of "M2_home\conf\settings.xml", noting that the "m2_home" here refers to the installation path of MAVEN. We can customize MAVEN settings in this file, but there are two drawbacks to this configuration:

(1) This configuration is global in nature, all users on the current computer will be affected by the configuration;

(2) When we download a new version of Maven and want to apply the original configuration, we have to go to the original maven to copy the "settings.xml" file to the new Maven;

MAVEN provides a solution that uses user-scoped configuration. After we have executed some instructions using MAVEN, there will be a folder named ". M2" in the user directory where we can copy the "settings.xml" file from Maven to this folder, and then configure MAVEN here. This configuration only works for the current user, and after MAVEN has been upgraded, there is no need to reconfigure the new maven.

MAVEN Installation Best Practices (Windows platform)

Related Article

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.