[Maven] The Eclipse Plugin's MAVEN configuration and problem resolution.

Source: Internet
Author: User

Preface:
today I installed the MAVEN environment in my own environment, and installing the Eclipse plug-in, I did encounter some problems in the process of finding the plug-in, but found a problem.
after the plug-in is installed, creating a MAVEN project with Eclipse has two questions, summarizing some of them and making it easier for other friends to solve the problem.

one, the installation of the MAVEN environment
here do not do too much to repeat, first you need to go to MAVEN official website to download maven package, and then configure the MAVEN environment.
MAVEN environment variable configuration: http://jingyan.baidu.com/article/cb5d61050b8ee7005d2fe04e.html


Two, eclipse plugin-->maven
Installing the Maven plugin in Eclipse is divided into an online installation and a local installation, which is recommended locally. Online installation is really slow (don't know if it's because of the wall?) And it doesn't have to be successful.
First give everyone a plugin that you share: Link: Http://pan.baidu.com/s/1jI54SlC Password: 4g3x( if the link expires please leave a message )

Once downloaded, place the extracted two files in the Eclipse installation directory
and restart eclipse:


Third, configure the Maven plugin

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

  

  

3.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.

3.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:

  

  

  



Iv. using the Maven plugin in Eclipse4.1. Import Maven Project

File→import

  

  

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

  

4.2. New MAVEN Project

  

  

  

  

  

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

  

4.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:

  

Five, FAQs

5.1, after using MAVEN to create a Web project, the JSP introduces static file hint error. JSP Error: Javax.servlet.ServletException cannot is resolved to a type.

Solution:

1. The following dependencies are raised in the Maven Pom file:

<dependency>
<groupId>javax.servlet.jsp</groupId>

<artifactId>jsp-api</artifactId>

<version>2.2.1-b03</version>

</dependency>

<dependency>

<groupId>javax.servlet</groupId>

<artifactId>servlet-api</artifactId>

Version>3.0-alpha-1</version>

</dependency>

2. Creating a Web container under the build path

Select the item--right--build path---Configure build path. --Add Library (Libraries tab)--Server Runtime. Such as:



5.2 Eclipse cannot build Src/main/java resource folder after setting up Maven Project |
The problem is that the project uses an environment that is below JRE7:

Solution:
On the project, right-select Properties, then click Java Build Path, under Librarys, edit the JRE System Library, select workspace Default JRE.



This is the problem I encountered when using the Maven plugin.

[Maven] The Eclipse Plugin's MAVEN configuration and problem resolution.

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.