Create a project with Maven in eclipse

Source: Internet
Author: User

1. What is Maven

MAVEN is a cross-platform project management tool under the Apache organization that is used primarily to help build, package, test, and deploy projects. MAVEN provides a standard software lifecycle model and build model that can be configured to fully manage the project. Its cross-platform nature ensures that the same commands can be used to accomplish the task on different operating systems. MAVEN abstracts the process of building into a life cycle process, using different implemented plug-ins to accomplish the actual work in different stages, which greatly avoids the duplication of design and script coding, and greatly implements reuse.

2. Maven vs Ant

Ant is also a cross-platform project building tool under Apache, a task-and dependency-based build system that is procedural.

The developer needs to display each task, each containing a set of XML-encoded instructions, which must be explicitly told in the instruction where the ant source code is stored, where the resulting bytecode is saved, and how the bytecode is packaged into a jar file. Ant has no life cycle, you have to define dependencies between tasks and tasks, and you need to manually define the execution sequence and logical relationships of tasks. This virtually creates a lot of code duplication.

MAVEN is not only a project building tool, but also a project management tool.

It has an agreed directory structure and lifecycle, each phase of the project build is implemented by plug-ins, developers only need to follow the agreed directory structure to create projects, and then configure the basic elements of life projects in the file, MAVEN will complete the entire build process in sequence. These features of Maven greatly reduce the duplication of code in some way.

3. MAVEN installation and basic settings

This article describes the installation of Maven on the Windows platform. Maven 3 needs to run on a version above JDK1.4.

First make sure that the JDK is installed in the system and that the Java environment variables are set correctly.

Maven is: http://maven.apache.org/download.cgi. Unzip the downloaded file into the specified directory, such as C:\Maven-3.0.

Set environment variables. Open My Computer > Properties > Advanced > Environment variables, create a new system variable Maven_home, set the variable value to Maven install directory: C:\Maven-3.0. Select the environment variable named "path" in system variables, double-click the variable, add the absolute path of the bin directory in the Maven installation path to the value of the path variable, and delimit it with the semicolon of the half-width and the existing path: C:\Maven-3.0\bin.

After the configuration is complete, enter MVN-V in the Windows DOS window to verify that the Maven installation is successful, and that if the installation succeeds, the result will display the installation information such as the version number correctly, 1.

Figure 1. Installation Information

4. Create a MAVEN project in Eclipse1), install M2eclipse plug-in

The integration of Maven plugins in Eclipse makes it easy to create and manipulate Maven project.

Use the following steps to complete the installation of the M2eclipse plugin:

A), select Help > Install New Software in the Eclipse menu bar

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

b), in the popup dialog box, click the Add button to enter Maven and HTTP://M2ECLIPSE.SONATYPE.ORG/SITES/M2E in the Name and location fields of the Add Repository dialog box that pops up. Click OK

c), Select M2eclipse in the list of resources that pops up, click Next to follow the prompts to install

d), restart Eclipse after installation, open Window > Preferences Check if MAVEN plugin is installed successfully

After the installation is complete, create a MAVEN project project.

2), create MAVEN project

A), click the Eclipse menu bar file->new->ohter->maven, select Maven Project in the dialog box that pops up


Create a project with Maven 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.