Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interaction between Eclipse and Maven

Tags:

eclipse

maven

Note: I'm asking about the command line mvn tool, although I imagine similar answers would apply to the m2eclipse plugin?

It's a bit confusing what the command line mvn targets that mention Eclipse actually do and DON'T do.

Confirming what I believe I understand:

  • The mvn eclipse:eclipse command is just generating Eclipse dot-project files? You would them import them into Eclipse?

  • The -Declipse.workspace=(eclipse-workspace-path) eclipse:add-maven-repo is just updating workspace files to point a repository, but does not tell the workspace anything about your maven projects, even if you do both steps in the same command?

When I first saw the references to Eclipse in the Maven doc I thought perhaps you could generate set of Eclipse projects and add them to a template workspace from the command line, but I guess that was just wisshfull thinking.

like image 295
Mark Bennett Avatar asked Feb 26 '11 18:02

Mark Bennett


1 Answers

The m2eclipse and command line mvn tool take two very different approaches to Eclipse/Maven integration. It sounds like your question is about mvn tool.

The mvn eclipse:eclipse command reads your pom file and creates Eclipse projects with correct metadata so that Eclipse will understand project types, relationships, classpath, etc. It does not actually import those projects into a workspace as creating a workspace or importing projects into a workspace requires running Eclipse. You have to re-run this command when anything in your pom changes. Once you run this command, it is simple to import the created projects into your workspace. Just start Eclipse and use File -> Import -> Existing Projects wizard. Once you've imported projects you will not have to repeat this process after re-generating metadata unless the number of projects have changes. Just start Eclipse back up, select all projects and invoke refresh from the context menu.

like image 140
Konstantin Komissarchik Avatar answered Nov 24 '22 09:11

Konstantin Komissarchik