EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login
Home Software Development Software Development Tutorials Maven Tutorial Maven Eclipse Plugin
Secondary Sidebar
Maven Tutorial
  • Maven Basic and advance
    • What is Maven
    • How to Install Maven
    • Maven Commands
    • Maven GroupId
    • Maven WAR Plugin
    • Maven Build Command
    • Maven Failsafe Plugin
    • Maven Profile
    • IntelliJ Maven
    • Maven Enforcer Plugin
    • Maven Javadoc Plugin
    • Maven WAR Plugin
    • Maven Build Command
    • Maven GroupId
    • Maven Force Update
    • Maven Encrypt Password
    • Maven Environment Variables
    • AssertJ Maven
    • Maven Run Single Test
    • Maven kafka-clients
    • Maven Quickstart Archetype
    • Maven Install Dependencies
    • Maven XMLBeans
    • Maven Local Repository
    • Maven Versions
    • Maven Jar Plugin
    • Maven Assembly Plugin
    • Maven exec plugin
    • Maven Central Repository
    • Maven Surefire
    • Maven Deploy
    • Maven Phases
    • Maven Archetype
    • Maven Skip Test
    • Maven Dependency Scope
    • Maven Shade Plugin
    • Maven Repository Spring
    • Maven Eclipse Plugin
    • Maven Exclude Dependency
    • Maven Life Cycle
    • Maven Repository
    • Maven POM File
    • Maven Plugins
    • What is Maven Plugins
    • Maven Interview Questions
    • Maven Flags
    • Maven Project
    • Maven Settings.XML

Maven Eclipse Plugin

By Payal UdhaniPayal Udhani

Maven Eclipse Plugin

Introduction to Maven Eclipse Plugin

Maven project can be created without using any specific IDE by using only text editor such as gedit of notepad i.e using the command-line interface(CLI). However, as most of the maven framework and technology are used in java projects it is convenient to use maven in the IDEs for java projects. One of the most preferred IDE for java projects is the Eclipse IDE. Now, even though new maven projects can be created in Eclipse IDE. There is often a necessity to import the existing maven projects in eclipse. For this eclipse plugin was being used create the files for eclipse IDE such as .project, .classpath files, and .settings folder that are required by an eclipse for using maven project. In which mvn eclipse: eclipse command of maven eclipse plugin was being used to generate these files that will be further useful when the same project was opened in eclipse. However, this plugin usage is deprecated now and the use of M2E or maven2E that stands for maven to eclipse integration should be used. It makes the task to use the existing maven project in eclipse IDE easily and effectively and also provides us with other features. In this article, we will learn the assistance of the maven plugin, how to install it in eclipse and use it to import the existing maven project in eclipse IDE.

The Assistance of M2E Maven Eclipse Plugin

This plugin provides many features that can be used for easy and efficiently using the maven projects using java language. Some of them are listed here:

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

  • It provides integration between eclipse IDE and maven projects.
  • It helps in viewing the remote and local maven repository’s contents.
  • It provides the facility to create new maven projects that can be single-module or multi-module maven projects in eclipse IDE.
  • This plugin helps us to import the existing maven projects in the IDE.
  • Provision of managing, viewing, and changing the pom.xml file in the graphical format.
  • Plugins and dependencies can be managed and searched easily.
  • Building the maven project becomes simpler by using the maven builds and this plugin.

Installation -The M2E eclipse plugin is already installed in the eclipse IDE and can be checked by going to the following path to check maven eclipse plugin:

Window -> Preferences -> search for Maven/ view in the list on the left side of the window as shown in the below image:

Maven Eclipse Plugin Example 1

If this plugin is not pre-installed in your eclipse IDE, you can download and install the latest release of this plugin by navigating to the following path in eclipse –

Help -> Install New Software…

You will see a list of already downloaded packages.

Enter the name of the site from where you want to download the plugin in work with section.

For our purpose, We will enter http://download.eclipse.org/ link to get the latest release of m2e plugin. Then click on the add button and add a new repository. Then click ok and complete the installation of m2e plugin in your eclipse.

1. Check Plugin Indexing for the Local Repository

Before we provide for the sections of creating new maven projects and importing existing maven projects, it is necessary to make sure that the local repository is indexed properly. To navigate to the repositories of the maven you can follow the following path –

Windows -> Show View and then click on other options that will open the show view window. Search for repositories and you will see the option of maven repositories as shown in the image –

show view window Example 2

After choosing the maven repositories option you will be displayed with the following list of repositories –

Maven Eclipse Plugin Example 3

By opening the local repositories option, you will see the local repository paths. You can rebuild the index of these repositories by right-clicking on them and click on the rebuild index. It is also preferable to rebuild the index of the global repository to maven central repository but it is time-consuming and requires internet connection. Now, let us proceed with creating a new maven project in eclipse IDE.

2. Creating a Maven Project

You can create a new maven project simply by clicking on the File -> New -> others that will pop out the following window where you can search for maven and choose maven project option –

Maven Eclipse Plugin Example 4

Click on the create a simple project on the next window as shown below and click next.

Maven Eclipse Plugin Example 5

Then enter the artifact is and group id of the maven project you wish to create and click on finish. In my case, we have entered com.educba as my group id and demo-eclipse-plugin as my artifact id as shown below –

Maven Eclipse Plugin Example 6

That will lead to the creation of your new maven project with following project structure that can be seen in project explorer window.

Maven Eclipse Plugin Example 7

3. Importing Existing Maven Project

You can add the existing maven project created by you using CLI i.e command-line interface or any other editor to the Eclipse IDE with the help of the M2E maven eclipse plugin integration. You can delete the .project, .classpath files, and .settings folder that are present in your maven project. For example, we have the following maven project that we have to import in eclipse in which we will delete the above-mentioned files. The above files and folders are hidden. Make sure to make settings to see hidden files and delete them.

Maven Eclipse Plugin Example 8

Now, click on the file -> Import option in your eclipse IDE and where you will see a popup window of import. Search for maven and choose existing maven project option after which you will see following window –

Import Example 9

Choose your root directory that in my case is chosen as shown below and then click on ok. After that click on finish.

Maven Eclipse Plugin Example 10

After that, you will see that your project is imported in your eclipse Ide and its project structure can be seen in the project explorer window as shown below.

Project Explorer Example 11

You can go to your project directory and see that all the project-related files that will be used by eclipse Ide that we previously deleted will have been created again after importing the maven project in eclipse because of using M2E plugin.

M2E plugin Example 12

Conclusion

We can make the use of the M2E eclipse plugin of maven for importing existing maven projects in eclipse IDE or creating the new maven project and managing the build process and dependencies in your maven project.

Recommended Article

This is a guide to Maven Eclipse Plugin. Here we discuss the use of the M2E eclipse plugin of maven for importing existing maven projects in eclipse IDE or creating the new maven project. You can also go through our other suggested articles to learn more –

  1. Maven Life Cycle
  2. Maven Repository
  3. What is Maven Plugins?
  4. Maven Repository Spring
Popular Course in this category
Maven Training (4 Courses, 6 Projects)
  4 Online Courses |  6 Hands-on Project |  26+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more