Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing multiple maven projects from git into eclipse

I've got a git repository with two Maven projects "foo" and "bar". The structure of the cloned repo is as follows:

myrepo
  .git
  foo
    pom.xml
  bar
    pom.xml

What I want

Two projects "foo" and "bar" in my workspace with maven nature and working Team menu. I'm running Eclipse 3.7 with m2e 1.0.0.

I tried the following:

Import -> Check out maven projects from SCM

This clones the repo into a new folder in my workspace folder and imports the two projects, but without connection to git (Team menu is mostly empty).

Import -> Projects from Git

With this option I can only import the entire repo as a single general project (with working Team menu). If I then use "Import -> Existing maven projects", the projects foo and bar are imported but without working Team menu.

Is it possible at all to import multiple projects from a git repo with working Team menus?

like image 425
Jens Theeß Avatar asked Jul 19 '11 08:07

Jens Theeß


2 Answers

As far as I know and are able to perform on my setup (Eclipse 3.7, Egit 1.0.0, m2e 1.0, m2e-egit 0.13), it is not possible in a single step. The cleanest procedure that I know of is the following:

  • Clone your Git repository (preferably from Eclipse, otherwise you also need to add the repository to the Git Repositories view);
  • Import -> Check out existing Maven projects from the root folder of your cloned repo;
  • Select all the resulting Eclipse projects, and choose Team -> Share project;
  • Now select Git and check Use or create Repository in parent folder of project.

Long-winded? Sure. But cloning beforehand gives you control over the folder name you check out to, in contrast to Check out Maven projects from SCM which on my machine produces a "maven_{unix_timestamp}" like folder name.

I agree wholeheartedly with you that a quicker procedure should be available.

like image 176
Luca Geretti Avatar answered Oct 13 '22 22:10

Luca Geretti


Here are the steps I used (using eclipse helios, egit and maven plugins)

  1. From git repo perspective, clone your repo (I'm pulling in git://git.springsource.org/spring-security/spring-security.git for example)
  2. Use "Import -> Projects from Git" to import as single general project.
  3. On this project use "Import -> Existing Maven project" to import separate subprojects.
  4. On each new project, go to "Team -> Share Project -> Git".
  5. If desired, remove the original project imported in step 2 above. Just remove from workspace, don't remove disk contents.
like image 30
Ken Krueger Avatar answered Oct 13 '22 22:10

Ken Krueger