MAVEN installation, setup steps with Eclipse

Source: Internet
Author: User
Tags jboss

MAVEN's specific reference books can be seen: "Maven combat"

Download maven to: http://maven.apache.org/

The basic use of Maven for Eclipse can be seen here: http://www.iteye.com/topic/1123225

1. Unzip the downloaded Maven zip file to a place like this: f:\tool\apache-maven-3.2.5

2, set environment variables (similar java_home):

Add a new "MAVEN":

Add "MAVEN" to Path:

3. Open the command line to see if MAVEN is configured correctly:

You can see the above message stating that it is configured properly.

4. In the command line, enter:

MVN Help:system
Operation Result:

When this command finishes running, a ". M2" folder will be automatically generated in the Windows user folder with a repository directory, such as:

C:\Users\xxxxx\.m2

This is the local user repository, which will be downloaded in the future with a jar package that is automatically downloaded using MAVEN.

5. Eclipse Configuration maven:

Click Window->perference->maven->installations in eclipse to set up your own download of Maven.

The original eclipse-brought Maven can be removed because most versions are not the same, leading to inexplicable problems later.

6. New Maven Web project method:

6.1) Ctrl + N:

In this way, a MAVEN Web project has been built. However, by default, the Java version in the Project facet is 1.5, and you want to modify it to the local Java version.

6.2) Right-click the project->properties and change it to:

I'm using JBoss here, so I'm going to set the runtimes in the dynamic Web module to JBoss:

6.2) Create a new Src/main/java source folder with Maven's default contract:

This folder needs to be built manually, and cannot be built in the new source folder mode. (estimated to be bug, always hint already exists, but in fact not)

6.3) Open Pom.xml file, join dependency (dependency)

For example I added a few dependencies: Spring, Freemarker, Modelmapper.

Save Pom.xml,eclipse will automatically go to the central server to download the corresponding jar package, jar package saved in the user folder./m2

Here, Maven's eclipse configuration is basically complete.

7. Build and build Maven

Right-click Project->run as->maven Install in eclipse

Maven defaults to placing the generated war file, class-compiled files in the target directory in the project folder

MAVEN installation, setup steps with 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.