brain storm
brain storm

Reputation: 31262

how to import maven-based projects into Eclipse effectively for large projects?

I want to import maven-based projects in Eclipse. For example, here is a project that I am interested in importing to my Eclipse workspace.

I have two options:

  1. since the project directory has a pom.xml in it, I can do

import > Existing Maven Projects

The project gets loaded into workspace.

  1. run mvn eclipse:eclipse in the directory containing pom.xml. with this, an eclipse project is created (i.e .classpath and .project files).

I can then do

import > Existing Projects into Workspace

But with the second option, when I do

right-click on the project > run As > ....,

I do not see any options to run maven commands (such as Maven build, Maven build...).

however, with the option 1, I can see these run configurations.

Q1) what is the recommended way to import existing maven projects into Eclispse. 1 or 2 or something else?

Q2) why in option 2, maven commands are not available and how to get them back upon right click on the project.

Thanks.

Just clarify, what I mean, here is the screen-shot:

enter image description here

Upvotes: 0

Views: 69

Answers (2)

ivoruJavaBoy
ivoruJavaBoy

Reputation: 1357

Q1) what is the recommended way to import existing maven projects into Eclispse. 1 or 2 or something else?

I don't use the command line, it give me problems too. Do like this: file menu, import, choose Maven and select existing maven project, then just select you project location.

Q2) why in option 2, maven commands are not available and how to get them back upon right click on the project.

If Eclipse does not give to you the possibility to run maven command means that Eclipse does not recognize you project as a Maven project. So right click on the project, click configuration and convert the project to maven project.

Upvotes: 1

BilalDja
BilalDja

Reputation: 1092

For me I always use the m2e (First option) to import maven projects to Eclipse workspace. And for the second option Right click on the project go to configure then "convert to Maven project", the project will be treated as a Maven project.

Upvotes: 2

Related Questions