How to import Maven Project in Eclipse IDE

Last updated on May 27 2022
Mrinalini Pandey

Table of Contents

How to import Maven Project in Eclipse IDE

Maven – Eclipse IDE

Eclipse provides an excellent plugin m2eclipse which seamlessly integrates Maven and Eclipse together.
Some of features of m2eclipse are listed below −
• You can run Maven goals from Eclipse.
• You can view the output of Maven commands inside the Eclipse, using its own console.
• You can update maven dependencies with IDE.
• You can Launch Maven builds from within Eclipse.
• It does the dependency management for Eclipse build path based on Maven’s pom.xml.
• It resolves Maven dependencies from the Eclipse workspace without installing to local Maven repository (requires dependency project be in equivalent workspace).
• It automatic downloads the required dependencies and sources from the remote Maven repositories.
• It provides wizards for creating new Maven projects, pom.xml and to enable Maven support on existing projects
• It provides quick search for dependencies in remote Maven repositories.

Installing m2eclipse plugin

Use one of the subsequent 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)
Subsequent example will help you to leverage benefits of integrating Eclipse and maven.

Import a maven project in Eclipse

• Open Eclipse.
• Select File > Import > option.
• Select Maven Projects Option. Click on Next Button.

Page 2 Image 1 8
Import maven project

• Select Project location, where a project was created using Maven. We’ve created a Java Project consumer Banking in the previous chapters. Go to ‘Creating Java Project’ chapter, to see how to create a project using Maven.
• Click Finish Button.

Page 3 Image 2 5
Finish Button

Now, you can see the maven project in eclipse.

Page 3 Image 3 5
Eclipse

Now, have a look at consumer Banking project properties. You can see that Eclipse has added Maven dependencies to java build path.

Page 4 Image 4 4
Consumer Banking

Now, it’s time to build this project using maven capability of eclipse.
• Right Click on consumerBanking project to open context menu.
• Select Run as option.
• Then maven package option.
Maven will start building the project. You can see the output in Eclipse Console as follows −
[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 on App.java. Select Run As option. Then select Java Application.

Page 6 Image 5 3
Select

You will see the result as follows −
Hello World!

So, this brings us to the end of blog. This Tecklearn ‘How to import Maven Project in Eclipse IDE’ blog helps you with commonly asked questions if you are looking out for a job in DevOps. If you wish to learn Maven and build a career in DevOps domain, then check out our interactive, Maven Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

Maven

Maven Training

About the Course

Tecklearn has specially designed this Maven Training Course to advance your skills for a successful career in this domain. The course will cover different components of Maven and how they are used in software development operations. You will get an in-depth knowledge of these concepts and will be able to work on related demos. Upon completion of this online training, you will hold a solid understanding and hands-on experience with Maven.

Why Should you take Maven Training?

• The average salary for “ant maven” ranges from approximately $71,430 per year for Entry Level Engineer to $126,916 per year for Development Operations Engineer. – Indeed.com
• According to Grand View Research, the DevOps market size is estimated to be worth $12.85 billion by 2025. DevOps professionals are highly paid and in-demand throughout industries including retail, eCommerce, finance, and technology.

What you will Learn in this Course?

Introduction to DevOps

• What is Software Development
• Software Development Life Cycle
• Why DevOps?
• What is DevOps?
• DevOps Lifecycle
• DevOps Tools
• Benefits of DevOps
• How DevOps is related to Agile Delivery
• DevOps Implementation

Maven

• Maven
• Maven Directory
• Maven Lifecycle
• Maven Dependencies
• Maven Repositories
• Phases and Goals

0 responses on "How to import Maven Project in Eclipse IDE"

Leave a Message

Your email address will not be published. Required fields are marked *