Reputation: 31262
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:
pom.xml
in it, I can doimport > Existing Maven Projects
The project gets loaded into workspace.
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:
Upvotes: 0
Views: 69
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
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