Maven Learning Summary (vi)--maven and Eclipse integration

Source: Internet
Author: User

First, install the MAVEN plugin

Download the Maven plugin as shown in the following: The path for the plugin to be stored is:e:/mavenproject/maven2eclipseplugin

  

    1. Enter the Dropins directory in Eclipse and create a new three txt file (zest.txt,m2e.txt,m2e-extras.txt ). As shown in the following:

  

the contents of the M2e.txt T file are as follows:path=e:/mavenproject/maven2eclipseplugin/m2e

The contents of the m2e-extras.txt file are as follows: Path=e:/mavenproject/maven2eclipseplugin/m2e-extras

The contents of the zest.txt file are as follows: path=e:/mavenproject/maven2eclipseplugin/gef-zest-3.7.1

   The value of path path is the address of the directory where the plug-in resides on this machine

To restart Eclipse, click on the Windows→preferences,maven plugin to see the following screen after successful installation:

  

Ii. configuring MAVEN Plug-in 2.1, configuring MAVEN for use

  

We do not use the default installed MAVEN to configure our own download of the installed Maven, as shown in:

  

  

2.2. Configure User Settings

The default configuration for User settings is as follows:

  

Before I installed and configured maven, I had set the MAVEN local repository location to the "E:\repository" directory, so I needed to change "C:\Users\gacl\.m2\repository" to "E:\repository"

First find the Settings.xml file in the Conf directory under the MAVEN installation directory, as shown in:

  

Copy the settings.xml file from the Conf directory to the location of the MAVEN local repository "E:\repository" directory, as shown in:

  

  

After these two steps, the MAVEN plugin is set up.

2.3. Configuring the JDK used by MAVEN compilation

Because Maven must be JDK1.6 above to work properly, you need to configure the JDK used by eclipse.

Enter the Window->preferences window, select java->installed jres, add the JDK via the Add button to add the corresponding path, or in the compile time will be error:

  No compiler is provided in this environment. Perhaps is running on a JRE rather than a JDK?

  

Next, enter installed JREs's Child execute environment: Select JavaSE-1.5, JavaSE-1.6, JavaSE-1.7 on the left, and on the right, select the JDK version to use at compile time, as shown in:

  

  

  

Iii. using Maven plugin 3.1 in Eclipse, importing MAVEN projects

File→import

  

  

Click "Finish" button to complete the project import, as shown in:

  

3.2. New MAVEN Project

  

  

  

  

  

Click the "Finish" button to complete the project creation and create a good project as shown in:

  

3.3. Execute the MVN command in Eclipse

Select the item, right-click → "Run as" or "Debug as" → Select the appropriate maven command to execute as shown:

  

This way you can only execute one MAVEN command at a time, and if you imagine using a combo command like the cmd command line, you could do this

  

A dialog box appears as shown below

  

Enter the combination command to execute in the Goals input box, as shown in:

  

That's what MAVEN is using with Eclipse integration.

Maven Learning Summary (vi)--maven and Eclipse integration

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.