MAVEN installation and configuration and use in eclipse

Source: Internet
Author: User
Tags file copy

1. Install maven locally  

This is very simple, it is not worthy of the map, only in words to write on the line

(1) on the Apache website download maven2,:http://maven.apache.org/download.html, I downloaded the version is: Maven-2.2.1-bin.zip.

(2) Unzip the maven-2.2.1-bin.zip to D:\Program Files\maven

(3) Configuring environment variables

(3.1) Create a new button in the environment variable, enter m2_home in the variable name, and enter D:\Program Files\maven\apache_maven in the variable value.

(3.2) Then find path, click Edit to add the following statement after the value of the variable:;% M2_home%\bin

(4) To see if the installation was successful, enter the DOS command window and enter: Mvn-v

indicates that the installation was successful

Note: Install MVN, before the package JDK to successfully installed, especially the Java_home variable to be set, if not set java_home variable or the java_home variable is written in another name, such as: Java_home, This installs Maven also will error, said that cannot find the Java home, must use Java_home this name to define the JDK installation path.

2 Modifying the MAVEN repository storage location

Find the installation of MAVEN conf below the Seting.xml file, mine is under E:\develop\maven\apache-maven-2.2.1\conf\

The MAVEN repository defaults to the. M2 folder under the local user's Temp folder under Repository, mine is under the C:\USERS\ZHANGSAN\.M2 directory,

Now let's modify to assign it to our own path, I'm now going to assign the repository to the E:\repository directory, just open the log-off local repository, and change it to the following:

Why to modify the warehouse storage location:

because Maven just installed when we can see that Maven is very small, only the most basic things, but once we use it, we will download everything we need to the warehouse, as we need to invoke more commands, the warehouse will grow larger, so it is best not to put on the C drive, Otherwise, the system is getting slower and later, and the system will be re-installed again next time.

3. Configure Maven in Eclipse

Note that the eclipse we are using is specifically for Java EE Development, not the basic eclipse, but it is important to note that


In some advanced versions there may be a Maven plugin built in, and we don't need to install it,

(1). Specifically, see if there is a maven option in Windowns-preference

if not , You can install the latest M2E plugin for Eclipse from address http://download.eclipse.org/technology/m2e/releases online

First step: Select the Install new software menu item under the Help menu and the following interface appears .

Click OK when you are finished typing. At this point, the corresponding address can be installed on the plug-in list, as shown in

You can then follow the prompts to install. You will need to restart eclipse after the installation is complete.

After the installation is complete, we can see that the menu window->preferences a list of Maven's menu bars after the click-through.

(2) Configure your locally installed Maven into eclipse

We can open the Maven menu bar and find the corresponding installations menu click, in the right window where we can choose the Add button to add our own MAVEN installation directory.

(3) Add the local Maven Setting.xml profile file to eclipse

Click User settings The first is a global setting, all users can access, select the Setting.xml file under the native installation directory

The second is only the user can access, we have just the local installation directory under the Setting.xml file copy to


After the previous selection, Eclipse reads the storage location of the repository inside the Setting.xml configuration file and automatically displays it to the local repository, which is the third red line in the box.

Then click OK to complete the configuration of the Eclipse Maven plugin to use Maven in eclipse.

MAVEN installation and configuration and use in eclipse

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.