user1899082
user1899082

Reputation:

Best practice for importing maven projects into Eclipse

Pretty new to all this, so wanted to do what is the best practice for this scenario:

I checkout a project from GitHub that has POM file so it is a maven project. Now I want to write code in it in Eclipse. Ok so do I first run something like

mvn clean package 
mvn eclipse:eclipse

And then from Eclipse I say File->Import->Maven project ?

Or do I open a project in Eclipse and use Maven2Eclipse project inside eclipse to build it?

Upvotes: 1

Views: 496

Answers (2)

aet
aet

Reputation: 7292

One way is to use the EGit plugin in eclipse. Clone the repo in the Git Repositories view, and then there is an "import maven project" option in there. That way, the project is recognized by eclipse as both being in a git repo, and a maven project.

mvn eclipse:eclipse generates an eclipse .project for you, so yes, you could simply import that as a maven project. Even if you do not open it as a maven project, the m2e plugin will "convert it".

Either way, you would use m2e to build.

Upvotes: 2

tom
tom

Reputation: 2745

You do not need the two maven commands.

If you have the correct plugins you can just do File->Import->Maven project->'select the project'

M2Eclipse will recognise it and make all the changes needed.

Upvotes: 4

Related Questions