Maven study concluded (6) - Maven and Eclipse Integration

Maven study concluded (f) - Maven and Eclipse Integration

First, install Maven plugins

  Downloaded maven plug as shown below:, plugins are stored: E: / MavenProject / Maven2EclipsePlugin

  

  1. Into eclipse in dropins directory, three new txt file ( zest.txt, m2e.txt, M2e-extras.txt ). As shown below:

  

  m2e.txt content files t as follows: path = E: / MavenProject / Maven2EclipsePlugin / the M2e

  m2e-extras.txt content files as follows: path = E: / MavenProject /

  zest.txt contents of the file are as follows: path = E: /MavenProject/Maven2EclipsePlugin/GEF-zest-3.7.1

  path path widget is stored in the machine path address

  Restart eclipse, click Windows → the Preferences, Maven plug-in installed after successfully see the following screen:

  

Second, configure Maven plugins

2.1, configured to use Maven

  

  We do not use the Maven default installation, configuration, download and install our own good that Maven, as shown below:

  

  

2.2 Configuring User Settings

  User Settings default configuration as shown below:

  

  When before installing and configuring Maven, I have the Maven local repository location settings become "E: \ repository" directory, so it is necessary to "C: \ Users \ gacl \ .m2 \ repository" changed to "E: \ repository "

  First find Maven installation settings.xml file conf directory under the directory, as shown below:

  

  The settings.xml file conf directory to copy Maven local repository location "E: \ repository" directory, as shown below:

  

  

  After the above two steps, Maven plug-ins even set up.

2.3, used when configuring Maven build JDK

  Because Maven JDK1.6 must be able to run more than normal, so the need to configure the JDK Eclipse use.

  Enter window-> preferences window, select java-> Installed JREs, corresponding to an increase jdk path through the add button add to the mix, otherwise it will error at compile time:

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

  

  Next, into the Installed JREs subkey Execute Environment: Select JavaSE-1.5 on the left side, JavaSE-1.6, JavaSE-1.7, choose the right version jdk compile-time, as shown below:

  

  

  

Three, Eclipse plug-in to use Maven

3.1, import Maven projects

  File→import

  

  

  [Click Finish] button to complete the import of the project, as shown below:

  

3.2, the new Maven project

  

  

  

  

  

  Click [Finish] button to complete the creation of the project, to create a good project, as shown below:

  

3.3, execute mvn command in Eclipse

  Item is selected, right-click Run As → [] or [] → Debug As Maven selecting the appropriate command, as shown below:

  

  This way you can only execute a Maven command, imagine if the cmd command line as a combination command, you can do so

  

  At this time, a dialog box will pop up as shown below

  

  Goals in combination input box command to be executed, as shown below:

  

  These are the contents of Maven and Eclipse integration use.

Reproduced in: https: //my.oschina.net/zhanghaiyang/blog/606539

Guess you like

Origin blog.csdn.net/weixin_33770878/article/details/92654339