1. Install M2eclipse Plugin
To build the MAVEN project with Eclipse, we need to first install the Meeclipse plugin
Click on the Eclipse menu bar help->eclipse Marketplace Search the plugin Maven integration for Eclipse and click Install, as shown below:
Once installed, we click File->new->other in the Eclipse menu bar and you will see the following image in the pop-up dialog box:
2. Building MAVEN Projects
Taking eclipse3.6 as an example
1) Create a simple MAVEN project
Click on the Eclipse menu bar File->new->ohter->maven to get the dialog shown in the following figure:
Select Maven Project and click Next to go to the next dialog box and click Next to get the following dialog
As shown in the operation, select Maven-archetype-quickstart, click Next
According to the diagram to fill out GroupID, artfactid,version and other information, click Finish.
As a result, we have successfully created a simple MAVEN project, and the project structure is shown in the diagram
2 Create MAVEN Web project
Action is similar to creating a simple Maven project, click on the Eclipse menu File->new->other->maven->maven project
In the Select Maven-archetype interface do the following:
Click Next, fill in the appropriate information such as Groupid,artifactid,version, click Finish
The resulting MAVEN Web project structure is shown in the following illustration:
Right-click the item and click Properties->project Facets
As shown in the figure above you can see that the project is web2.3 java1.5 of course we can also change to the version we need to open the XML file my-app-web/.settings/ Org.eclipse.wst.common.project.facet.core.xml, make changes: 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>
<?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) Import Maven Project
Right-click in Eclipse Project Explorer and select Import in the pop-up box, as shown in the following illustration:
Select Existing Maven Projects and click Next to get the dialog shown in the following illustration:
Select a MAVEN project that has already been created and click Finish.
From this, the MAVEN project was successfully imported
3. Run Maven command
Right-click the item, click Run as, as shown below:
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 the Maven build to create a new command, as shown in the following figure:
The following figure fills in the MAVEN command and clicks Run
The new Maven command can be found in the following ways and run again: