Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Maven Eclipse

Maven Eclipse

Eclipse provides a very good plugin **m2eclipse **that integrates Maven with Eclipse.

The latest Eclipse comes with Maven built in; open Windows->Preferences, and if the following screen appears:

Some features of m2eclipse are listed below:

Importing a Maven Project in Eclipse

Now you can see the Maven project in Eclipse.

Look at the properties of the consumerBanking project; you can see that Eclipse has added all Maven dependencies to its build path.

Now let's use Eclipse's compile function to build this Maven project.

Maven starts building the project; you can see the output log in Eclipse'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] -------------------------------------------------------------------

Now, right-click App.java, select Run As option. Select As Java App

you will see the following result:

Hello World!