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
- <? XML version= "1.0" encoding="UTF-8"?>
- <faceted-project>
- <fixed facet="Wst.jsdt.web"/>
- <installed facet="java" version="1.5"/>
- <installed facet="Jst.web" version="2.3"/>
- <installed facet="Wst.jsdt.web" version="1.0"/>
- </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