Maven Combat (iii) Eclipse build MAVEN Project

Source: Internet
Author: User

1. Installing the M2eclipse Plugin
To build a Maven project with Eclipse, we need to install the Meeclipse plugin first
Click the Eclipse menu bar Help->eclipse Marketplace Search for the plugin maven integration for Eclipse and click Install,

Such as:

After installation, we'll click File->new->other in the Eclipse menu bar, and we'll see the following in the popup dialog box:

2. Build a MAVEN Project

Taking eclipse3.6 as an example

1) Create a simple MAVEN project

Click the Eclipse menu bar File->new->ohter->maven to get the dialog box as shown:



Select Maven Project and click Next to continue to the next dialog box and click Next to get the following dialog box



Select Maven-archetype-quickstart, click Next



Fill in the GroupID, artfactid,version and other information as shown, click Finish.

As a result, we have successfully created a simple MAVEN project with a project structure



2) Creating a MAVEN Web project

Action is similar to creating a simple Maven project, click the Eclipse menu File->new->other->maven->maven project

In the Select Maven-archetype interface, do the following:



Click Next, fill in the appropriate groupid,artifactid,version and other information, click Finish

The resulting MAVEN Web project structure looks like this:



Right-click the project and click Properties->project Facets



If you can see the project as web2.3 java1.5 of course we can also change to the version we need, open the XML file My-app-web/.settings/org.eclipse.wst.common.project.facet.core.xml, modify it:

XML code
  1. <? XML version= "1.0" encoding="UTF-8"?>
  2. <faceted-project>
  3. <fixed facet="Wst.jsdt.web"/>
  4. <installed facet="java" version="1.5"/>
  5. <installed facet="Jst.web" version="2.3"/>
  6. <installed facet="Wst.jsdt.web" version="1.0"/>
  7. </faceted-project>

3) Importing MAVEN projects

In Eclipse Project Explorer, right-click and select Import in the pop-up box to get as shown:

Select Existing Maven Projects and click Next to get the dialog box as shown:



Select a MAVEN project that has been created and click Finish.

As a result, importing MAVEN projects successfully

3. Run the MAVEN command

Right-click the project and click Run as, such as:



You can see a lot of existing MAVEN commands, click to run, and see the running information in the console

If the MAVEN command you want to run is not found here, click Maven Build to create a new command, as shown in the following:



If you fill in the Maven command, click Run



The new Maven command can be found in the following ways and run again:




Maven Combat (iii) Eclipse build MAVEN Project

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.