Getting started with Maven and building MAVEN projects with MyEclipse

Source: Internet
Author: User
Tags object model

Recently a Easyui project code wanted to see someone else write the Easyui, inadvertently found that the project was built by Maven, plus previously heard of MAVEN, has not touched. So on a whim, with Maven built a small demo.

MAVEN Official website: http://maven.apache.org/

According to the official website, MAVEN is an open source project management tool written in Java, based on a concept called the Project object Model (POM) that can manage the life cycle of a project, from build to release to document management.

Here are the steps I built:

1. Install Maven

A. Go to the official website to download the latest MAVEN, unzip, directory structure as follows

B. Configure environment variables (this is the main purpose in order to use command-line operations under Windows, if you just want to build maven with MyEclipse, you can skip this step)

Once configured, you can enter mvn-version on the command line to see if the configuration is successful, and if the following interface appears, the configuration is successful.

2. Configure Maven in MyEclipse

Open the menu in MyEclipse windows->preferences-> search "maven", find "Installations", add the Maven directory just now, tick And then introduce your maven settings.xml file. As shown in figure

3. Configure the local repository for MAVEN.

One of the benefits of using MAVEN to build a project is to simply declare which jar packages are being introduced, and MAVEN will automatically download the dependent jar package at the first boot, down to the local. The address of this local warehouse is in the previous step mentioned in the settings.xml file configuration, in the configuration of the following words on the line

<localRepository>F:\\mavenfiles</localRepository>

At this point, the MAVEN configuration is a success, and here's how to use Maven.


4. Create a project

The first way: New->other-> search "maven" and double-click Maven Project. Then select the project name and location, default is the current workspace, direct Next

Because the building is generally a Web project, so the directory select all, input webapp filter, find Maven-webapp,next. As follows

,

Enter the appropriate group ID and Ariface ID and click Done.

The second way:

Create a new Web project and, with the functionality provided by MyEclipse at the time of new, tick maven support-"ADD maven supports" and next down.

The final directory structure is as follows

If you are using Maven for the first time (and of course later, if the project depends on a jar that does not exist in your local repository), select the newly created project, right-->debug->dubug configuration

Enter the package command and click "Debug" to start downloading the relevant jar, which will be available when he has finished downloading.


Then deploy to Tomcat like a normal Web project, then launch and Access index.jsp, as follows.


At this point, MAVEN builds the project successfully. The next article will talk about some of MAVEN's configuration and core things, such as Pom.xml.

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.