Mark Bennett
Mark Bennett

Reputation: 1474

Interaction between Eclipse and 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:

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.

Upvotes: 8

Views: 6312

Answers (1)

Konstantin Komissarchik
Konstantin Komissarchik

Reputation: 29139

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.

Upvotes: 14

Related Questions