New Maven project under Eclipse

Source: Internet
Author: User

New MAVEN project under Eclipse 1.1 download maven install package

Enter Maven download page of official website: http://maven.apache.org/download.cgi, as shown in: \

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

1.2 Configuration

Modify the default local warehouse location

Enter Maven under the installation directory conf Sub-directory, open settings.xml make configuration changes.

Maven The default local warehouse location is the current user's working directory ". M2/repository" , the files in this directory will be much larger and occupy more and more space during use. 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 Label Settings

1.3 Eclipse Install Maven Plugin

Open Eclipse of the help->install New Software, as shown: Enter the following URL http://download.eclipse.org/technology/m2e/releases/1.3 , and then install maven plugins.

Note: Installation maven Be sure to pay attention to the version matching issue: Here is the problem I encountered when installing

first install encountered missing requirement:m2e logback configuration 1.7.0.20160603-1933 ( Org.eclipse.m2e.logback.configur the question.

This is due to Eclipse and the maven plugin version mismatch, my Eclipse The version is as follows and can only be installed m2e- http://download.eclipse.org/technology/m2e/releases/1.3 version of , A high version is an error

Configuring MAVEN under 1.4 Eclipse

Eclipse Install well maven after configuration is the default, you need to modify the configuration: first select Window->preferences, The following dialog box pops up

on the left, click maven directory node and select Installations child nodes, as shown in:

Click ADD Pop-up dialog box, select the local Maven Install the directory to associate with the machine just installed Maven . As shown in the following:

and then select usersettings child Nodes , Add settings.xml file , as shown :

1.5 Eclipse creating a MAVEN project

in the Eclipse in the menu bar, select " File", "News" , "other" menu item, the following dialog window opens, in the window, select "Maven" node under "Maven Project" entries, as shown, followed by the next step ... You can create the project as well.

need to select Maven-archetype-webapp used to create Web Project

The project you just created is as shown

1.6 mavenproject into Eclipse Engineering

in order to facilitate the Eclipse developed in Javaweb project, we need to put Maven the directory structure of the project is converted into Eclipse the directory structure of the project, in accordance with the following steps.

Select items in the right-click menu "Properties"->project Facets , pop up as shown in the dialog window:

Click Convert to faceted form the following dialog box pops up, tick Dynamic Web Module , the version you need to select is 3.0 , Tick Java Version Preferences

After completion, the project structure becomes as follows

If you still need to directly Eclipse Run this in Web Engineering, we also need to put Maven The dependency packages are added to the project classpath:

You also need to add deployment to Tomcat when the dependency package, such as:

Click "Finish" When you are finished, the dialog box looks like this:

then click "OK" button to complete these settings.

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.