I want to import existing maven project into eclipse. I found 2 ways to do it, one is through running from command line
mvn eclipse:eclipseand another is to install maven eclipse plugin from eclipse. What is the difference between the both and which one is preferable?
The maven-eclipse-plugin is a Maven plugin and has always been there (one of the first plugin available with Maven 1, one of the first plugin migrated to Maven 2). It has been during a long time the only decent way to
integrateimport an existing maven project with Eclipse. Actually, it doesn't provide real integration, it just generates the
.classpath files (it has also WTP support) from a Maven project. I've used this plugin during years and was very happy with it (and very unsatisfied at this time by Eclipse plugins for Maven like m2eclipse).
The m2eclipse plugin is one of the Eclipse plugins for Maven. It's actually the first and most mature of the projects aimed at integrating Maven within the Eclipse IDE (this has not always been the case, it was not really usable ~2 years ago, see the feedback in Mevenide vs. M2Eclipse, Q for Eclipse/IAM). But, even if I do not use things like creating a Maven project from Eclipse or the POM editor or other fancy wizards, I have to say that this plugin is now totally usable, provides very smooth integration, has nice features... In other words, I finally switched to it :) I'd now recommend it to any user (advanced or beginners).
If I install maven eclipse plugin through the eclipse menu Help -> Install New Software, do I still need to modify my pom.xml to include the maven eclipse plugin in the plugins section?
This question is a bit confusing but the answer is no. With the m2eclipse plugin installed, just right-click the package explorer and Import... > Maven projects to import an existing maven project into Eclipse.
File » Import » Maven » Existing Maven Project » Next
I was unable to import a Maven project with the steps suggested above until I figured out why it was not importing:
A maven project will not import if you have another Maven project with the same artifact id. Make sure that your project's artifact ID is unique in your eclipse workspace.
Since Eclipse Neon which contains Eclipse Maven Integration (m2e) 1.7, the preferred way is one of the following ways:
- File > Projects from File System... - This works for Eclipse projects (containing the file
.project) as well as for non-Eclipse projects that only contain the file
- If importing from a Git repository, in the Git Repositories view right-click the repository node, one folder or multiple selected folders in the Working Tree and choose Import Projects.... This opens the same dialog, but you don't have to select the directory.
I find the m2eclipse plugin to be more useful. This provides nice tools like the POM editor and creating a Maven project from within Eclipse.
Maven have a Eclipse plugin and Eclipse have a Maven plugin we are going to discus those things.when we using maven with those command line stuffs and etc when we are going through eclipse we don't want to that command line codes it have very much helpful, Maven and eclipse giving good integration ,they will work very well together thanks for that plugins
Step 1: Go to the maven project. Here my project is FirstApp.(Example my project is FirstApp)
There you can see one pom.xml file, now what we want is to generate an eclipse project using that pom.xml.
Step 2: Use mvn eclipse:eclipse command
Step 3: Verify the project
after execution of this command notice that two new files have been created
Note:- both these files are created for Eclipse. When you open those files you will notice a "M2_REPO" class variable is generate. You want to add that class path in eclipse, otherwise eclipse will show a error.
Step 4: Importing eclipse project
File -> Import -> General -> Existing Projects in Workspace -> Select root directory -> Done
mvn eclipse:eclipse will just generate general eclipse configuration files, this is fine if you have a simple project; but in case of a web-based project such as servlet/jsp you need to manually add Java EE features to eclipse (WTP).
To make the project runnable via eclipse servers portion, Configure Apache for Eclipse: Download and unzip Apache Tomcat somewhere. In Eclipse Windows -> Preferences -> Servers -> Runtime Environments add (Create local server), select your version of Tomcat, Next, Browse to the directory of the Tomcat you unzipped, click Finish.
Window -> Show View -> Servers Add the project to the server list
I am not experienced with Eclipse or Maven so the other answers seemed a bit over complicated.
The following simpler set of steps worked for me:
Prerequisite: Make sure you have Maven plugin installed in your Eclipse IDE: How to add Maven plugin to Eclipse
- Open Eclipse
- Click File > Import
- Type Maven in the search box under Select an import source:
- Select Existing Maven Projects
- Click Next
- Click Browse and select the folder that is the root of the Maven project (probably contains the
- Click Next
- Click Finish
- Importing Maven project into Eclipse
- Importing a Maven project into Eclipse from Git
- Maven root pom.xml marked as red when importing existing project into eclipse
- Importing an existing maven Project into Eclipse
- m2eclipse: add group id to project name when importing existing maven project into Eclipse
- pom.xml greyed out when importing maven project into eclipse
- Disabling the Maven project builder when importing projects into eclipse
- Maven Java web project not recognised when importing into Eclipse
- Issue Importing Maven (Atlassian JIRA Plugin) Project into Eclipse IDE
- Trouble when importing a maven project into eclipse kepler (swagger for jersey rest)
- Errors after importing Maven project into Eclipse
- Errors while importing Maven project into Eclipse
- 'Must Override a Superclass Method' Errors after importing a project into Eclipse
- Importing a GitHub project into Eclipse
- Importing JSON into an Eclipse project
- Missing AndroidManifest.xml when importing an old Android project into Eclipse
- How to build and run Maven projects after importing into Eclipse IDE
- Importing a CMake project into Eclipse CDT
- Problem importing Android project archives into Eclipse
- Invalid project description when importing project into Eclipse
- Import Maven multi-module project into Eclipse
- Error importing Maven Android Android project to Eclipse with ADT 20
- Importing existing java dynamic web project into Eclipse
- Importing multiple maven projects from git into eclipse
- Programmatically importing an existing project into Eclipse
- Null Pointer Importing Gradle Project Into Eclipse
- How to integrate maven generated vaadin project into eclipse vaadin plugin?
- Problems importing an Android project into Eclipse
- Importing Existing Android Project into Eclipse
More Query from same tag
- Why is my git file history lost after performing a move refactor in eclipse?
- JDBC connection works in IDE (eclipse), but not in .jar file
- Child Activity Not receiving data?
- How do I link an XSD to an XML file in Eclipse?
- How to generate classpath container for Eclipse
- java.lang.OutOfMemoryError: PermGen space in embeded jetty
- How to publish javadoc instead of index.jsp page for a REST web service
- android - Moto G mobile shows offline in the devices list in Eclipse
- How to hide program name on swt tooltip
- How does Validation.Exception in Java work?
- The application stopped
- How does one debug the processing of a JComboBox's actionEvent in Eclipse and avoid locking up the windowing system?
- Cross-Platform Single-Instance IDE Setup
- Android Eclipse drawable error
- Where can I download Groovy Grails Tool Suite version 3.5.1 for Windows?
- Plugin execution not covered by lifecycle configuration - Android maven
- what does **/*.java mean in java classpath
- Using default command in Eclipse RCP 4.X
- Include apk module as dependency in android studio
- Adding referenced libraries to /lib folder in Eclipse
- Google maps API V2 blank screen after installed on real device
- Trouble referencing appCompat in my project on Eclipse
- Android Installation. Problem with Android SDK
- Restore converted eclipse project to it's previous type
- Eclipse - Tomcat VM arguments does not change
- Open eclipse view along with custom editor in PDE
- class not found exception after replacing library in eclipse
- adding android project to git
- How do I add ITelephony.aidl to eclipse?
- Eclipse Incremental Builder Plugin does not work