Build a Maven project using eclipse

Source: Internet
Author: User
Build a Maven project using eclipse

1. Install the m2eclipse plug-in
To build a Maven project using eclipse, We need to install the meeclipse plug-in first.
Click "Help-> eclipse marketplace" in the eclipse menu bar to search for the plug-in Maven integration for eclipse and click "Install", as shown in:

 

 

After the installation is complete, click File> New> Other In the eclipse menu bar. The displayed dialog box is as follows:



 

2. Build a Maven Project

Take eclipse3.6 as an Example

1) create a simple Maven Project

On the eclipse menu bar, choose File> New> ohter> maven. The following dialog box is displayed:



 

Select the maven project and click Next. In the next dialog box, click Next. The following dialog box is displayed.



Operation, select Maven-Archetype-Quickstart, and click Next



Enter groupid, artfactid, version, and other information as shown in the following figure. Click Finish.

Therefore, we have successfully created a simple Maven project and project structure.



 

2) create a Maven WEB Project

Similar to creating a simple Maven project, choose File> New> Other> Maven project from the eclipse menu.

On the maven-Archetype page, perform the following operations:



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

Shows the maven web project structure:

 

 

Right-click the project and choose Properties> Project facets.



 

As you can see, the project is web2.3 java1.5. Of course, we can also change it to the version we need to open the XML file my-app-Web /. settings/org. eclipse. WST. common. project. facet. core. XML:

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" type = "codeph" text = "/codeph"/>
  5. <Installed facet = "JST. Web" version = "2.3" type = "regxph" text = "yourobjectname"/>
  6. <Installed facet = "WST. jsdt. Web" version = "1.0"/>
  7. </Faceted-Project>

 

3) import the maven Project

Right-click Eclipse project explorer and select import in the pop-up box, as shown in:

 

Select existing Maven projects and click Next. The displayed dialog box is displayed:



 

Select a created Maven project and click Finish.

Therefore, the maven project is imported successfully.

 

 

3. Run the maven command

Right-click the project and click Run as, for example:

 

 

You can see many existing Maven commands, click to run them, and you can see the running information on 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:



 

Enter the maven command and click Run.



 

The newly added Maven command can be found as follows and run again:



 

 

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.