Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Apache Maven Elipse IDE


May 26, 2021 Maven


Table of contents


Maven - Elipse IDE

Eclipse offers an excellent plug-in, m2eclipse, that enables Maven and Eclipse to integrate seamlessly.

Here are some of the features of m2eclipse:

  • You can run Maven's target file on an Eclipse environment.
  • You can use its own console to view the output of the Maven command directly in Eclipse.
  • Maven's dependencies can be updated under the IDE.
  • You can use Eclipse to build a Maven project.
  • Eclipse's Maven-based pom .xml to automate management dependencies.
  • It addresses the dependency between Maven and Eclipse's workspace without having to install to the local Maven repository (which relies on the project in the same workspace).
  • It automatically downloads the required dependencies and source code from the remote Maven library.
  • It provides wizards to build new Maven projects, pom .xml, and turn on Maven support on existing projects.
  • It provides a quick search of the remote Maven repository's dependencies.

Install the m2eclipse plug-in

Use any of the following links to install m2eclipse:

Eclipse Url
Eclipse 3.5 (Gallileo) Installing m2eclipse in Eclipse 3.5 (Gallileo)
Eclipse 3.6 (Helios) Installing m2eclipse in Eclipse 3.6 (Helios)

The following examples can help you effectively leverage integrated Eclipse and Maven.

Import a Maven project in Eclipse

  • Open Eclipse.
  • Select File and Import.
  • Select the Maven Projects option. Click the Next button.

Apache Maven Elipse IDE

  • Select the path to the project, which is the storage path when you create a project using Maven. S uppose we create a project: consumerBanking. Create a project with Maven - Create a project See how to create a project with Maven.
  • Click the Finish button.

Apache Maven Elipse IDE

Now you can see the Maven project in Eclipse.

Apache Maven Elipse IDE

If you look at the properties of the consumerBanking project, you can see that Eclipse has added everything Maven relies on to its build path.

Apache Maven Elipse IDE

Well, let's use Eclipse's compilation capabilities to build this Maven project.

  • Right-click to open the context menu for the consumerBanking project
  • Select the Run option
  • Then select the maven package option

Maven starts building and you can see the output logs in Eclispe's console.

[INFO] Scanning for projects...
[INFO] -------------------------------------------------------------------
[INFO] Building consumerBanking
[INFO] 
[INFO] Id: com.companyname.bank:consumerBanking:jar:1.0-SNAPSHOT
[INFO] task-segment: [package]
[INFO] -------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory: 
C:\MVN\consumerBanking\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.companyname.bank.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] [jar:jar]
[INFO] -------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] -------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Jul 12 18:18:24 IST 2012
[INFO] Final Memory: 2M/15M
[INFO] -------------------------------------------------------------------

Apache Maven Elipse IDE

Now right-click on the app .java. S elect the Run As option. Select As Java App.

You'll see the following results:

Hello World!