New Maven project under Eclipse

Source: Internet
Author: User

Eclipse * Version Eclipse * Download

New Maven project under Eclipse

1. Download MAVEN installation package

Go to the MAVEN website's download page: http://maven.apache.org/download.cgi, as shown in:

Select Current Latest version: "Apache-maven-3.3.9-bin.zip", download to local, unzip to local disk.

2. Configuration

2.1 Configuration of environment variables

2.2 Modifying the default local warehouse location

Enter the Conf subdirectory under the MAVEN installation directory to open settings.xml for configuration modifications.

<!--localrepository
| The path to the local repository maven would use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-

<localRepository>D:/SoftWare/maven/repository</localRepository>

The default local warehouse location for Maven is ". M2/repository" under the current user's working directory, and the files in this directory will be much larger and occupy more space in the process. It is generally recommended to change to a different disk directory. Change the default local repository to the directory you created by following the configuration below.

As shown in the Localrepository tag setting, change the default local repository to the D:/software/maven/repository directory (this directory structure needs to be created yourself).

2.3 Modifying the default central warehouse image

  The files in the MAVEN default central repository are not complete. Therefore, you need to add the other mirror address yourself. Add the following to the "<mirrors>" tab in the Settings.xml file:

In fact, is the following http://mirrors.ibiblio.org/maven2/

Save the changes, and also need to copy the settings.xml file to the "D:\SoftWare\maven" directory.

3. The Maven plugin installation in eclipse

The eclipse does not support maven by default. Need to add a m2eclipse plugin to it. Here are the specific steps.

3.1, plug-in installation

Open Eclipse's Help->install New software, as shown in:

Select "Add ..." button, the following dialog box pops up:

This dialog box is used to add a plugin address. Enter an identification name for the operation in the input box for "Name". In the "location" corresponding input box, enter the installation address of this plugin. Note: Maven's Eclipse plugin address is: http://download.eclipse.org/technology/m2e/releases. After entering, as shown:

Name:m2e

Location:http://download.eclipse.org/technology/m2e/releases

Once the input is complete, click on the "OK" button in the bottom right corner and the following dialog will appear:

When you are finished, click the "next>" button at the bottom right to install. After the installation is successful, you will be prompted to restart Eclipse to take effect for this configuration. After rebooting, this eclipse will be able to use the M2eclipse plugin feature.

I'm here, just, already installed.

This step, there may be

Note: Be sure to note the version matching issue when you install Maven: Here's the problem with my installation

First install Maven when encountering missing requirement:m2e logback configuration 1.7.0.20160603-1933 (Org.eclipse.m2e.logback.configur ... The problem.

This is because the Eclipse and MAVEN plugin versions do not match, my eclipse version is as follows, can only install m2e-http://download.eclipse.org/technology/m2e/releases/1.3 version, A high version is an error

3.2. Configure Maven under Eclipse

After the plug-in is installed, some configuration is required to get started with MAVEN functionality.

3.2.1, setting up the MAVEN program associated with the M2eclipse plugin

Need to modify the configuration: First select Window->preferences, the following dialog box appears

Expand the Maven directory node in the navigation bar on the left side of the dialog box, and select the "Installations" child node, as shown in:

The associated MAVEN installer is required for this application. To do this, select the "Add ..." button in the right panel and the Select dialog box for the MAVEN installation directory will pop up as follows:

Use this dialog box to select the specific installation directory for MAVEN. Click on the "OK" button when you're done. As shown in the following:

3.2.2, setting the custom local warehouse

Select the "usersettings" sub-node under the "Maven" node in the left menu tree of the conversation window, which is the default configuration file "C:\Documents and Settings\csdn\.m2\settings.xml" as shown in:

Here we need to modify the settings.xml file for our custom warehouse location. To do this, click the "Browse ..." button to select the Settings.xml file under the local warehouse directory that you modified in the previous step, as shown in:

Select the "settings.xml" file in the D:\SoftWare\maven directory, click the "Open" button to confirm the selection, then return to the dialog window as follows:

Click on the "OK" button in the bottom right corner to complete all the configuration changes.

4. Eclipse creates a MAVEN project

Selecting the "Other" menu item, "File" and "News" in the Eclipse menu bar, opens the following dialog window, selecting the "Maven Project" entry under the "Maven" node in the window, as shown, followed by the next step ... You can create the project as well.

Go on...

Thanks to the following bloggers:

Http://www.cnblogs.com/ljdblog/p/5840858.html

http://blog.csdn.net/qjyong/article/details/9098213

http://dead-knight.iteye.com/blog/1910783

New Maven project under 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.