instead of constantly generating project metadata via import->maven command, you can generate your project metadata once and the place it in your git repository along with the rest of your source code. after than, using import->git command will import a proper maven-enabled project, assuming you have maven tools installed.

make sure to place into the source control system all files in project dir that start with '.' such as .classpath and .project along with the entire contents of the .settings directory.


i would prefer to import projects into eclipse as maven projects rather than git project. doing this will still allow the project contents to be recognized as git contents. you can continue to perform git operations from eclipse. as you have mentioned the reverse is not true.

the nature of a project in eclipse is not based on the scm which holds the project, but on the type of project - whether war or jar, etc. - which is automagically determined when the project is imported as maven project.

i would be hesitant to check-in to scm ide-specific metadata. doing so assumes a lot of things - all developers are using the same ide or version of the ide, perhaps same version of jdk/jre, that they continue to use the same version throughout the project lifecycle and so on.


can't you import it as a git project and then (if you have the m2eclipse installed) right click on the project in the package explorer > maven > enable dependency management?


after checking out my branch in egit, i switched to the java view, then used file-->import, git-->projects from git, then selected the top level maven directory. this was with eclipse kepler.


i have a maven project with three submodules that is managed in git. i set them up in eclipse as follows:

  1. i registered the git repository with eclipse using egit
  2. i imported the projects as existing maven projects
  3. for each project, i went team | share project.


direct answer: go to files>>import>>git>>project from git (you should have git installed on eclips)


you should note that putting generated metadata under version control (let it be git or any other scm), is not a very good idea if there are more than one developer working on the codebase. two developers may have a totally different project or classpath setup. just as a heads up in case you intends to share the code at some time...


import without installing any additional connectors for mylyn:

  1. open git repositories view (window->show view->git repositories)
  2. press clone a git repository button and proceed with all steps
  3. in newly created repository expand working directory, right click on folder with your project and select import projects. then either choose import existing projects, or select import as general project. if needed after importing right click on your project and select configure->convert to maven project (and maven->update project).


here's my workaround, this is a solution to these issues:

  • you can't install m2e-egit (i get an error in juno)
  • converting a general project (connected to your git repository) to a maven project isn't working for you (the import maven projects step seems essential)
  • importing maven projects from your repository on the filesystem isn't showing the project connected to git.

  1. setup your git repository in the git repository exploring perspective.
    • switch to the java perspective, import > existing maven projects
    • browse to your git checkout in the filesystem, select the directory containing the pom.xml file. finish the import; you'll notice these projects aren't connected to git. :-(
    • delete these projects, but do not delete from filesystem. we don't want our clone deleted; this task also leaves the .project file behind so that we can import in the next step.
  2. go back to the git repository exploring perspective.
    • right-click your repository, import projects...
    • select import existing projects
    • in the explorer below, browse to and select the directory containing the pom.xml (and .project file) , then click next.
    • continue through the wizard.


i have been testing this out for my project.

  1. eclispe indigo
  2. "help > install new software" enable/install official git plug-ins at "eclipse git plugin .." and install the lot.
  3. enable the maven/egit connector with these instructions how do you get git integration working with m2eclipse?
  4. switch to the git repository perspective. right click paste the project git url. the defaults should all work. you may want to change the install folder it guesses.
  5. expand the cloned repository and right click on "working tree" and pick "import maven projects...".
  6. switch to the java perspective. right click on the project and choose "team > share project". select "git" and be sure to tick the box "use or create repository in parent folder of project".


as of this (updated) writing, a working setup is the following:

  1. eclipse 3.8 (eclipse indigo update site)
  2. egit 1.3.0 (eclipse indigo update site)
  3. m2e 1.0.200 (eclipse indigo update site)
  4. m2e-egit 0.14.0 (m2e marketplace when adding a connector)

tested on ubuntu raring.

you can certainly "import" -> "maven" -> "check out maven projects from scm", and this is the quickest way. however, such direct import currently does not give you control over the cloned repository folder name. you may be better off working from the "git repository" view and perform either a "clone from a git repository and add the clone to this view", followed by an "import maven projects" from such clone; the longest way would be to do your manual cloning and then "add an existing local git repository to this view", followed again by an "import maven projects". either case you have full control on the cloned folder.

a final comment on a side issue that made me cry in frustration. as far as i know, if the cloned repository lies on the root of your eclipse workspace, and your maven project file hierarchy has a pom on its root, then importing such root project will rename the cloned folder (with the template you chose, defaults to [artifactid]). without changing your project structure and without keeping files outside your workspace, you can easily work around this issue by cloning on a subsubfolder of the workspace folder.


step 1 : setting up eclipse

first of all you'll need to have a few eclipse plug-ins installed. so use eclipse ide software install feature in the help dropdown menu → install new software, and add link to available software site, then install it.

  1. git plugin (egit)-
  2. eclipse maven plugin (m2eclipse) -
  3. maven scm handler for egit (m2e-egit)

    install from the m2e marketplace (settings → maven → discovery → open catalog and search for " m2e-egit")

step 2 : clone the repository

clone(download) your maven projects from git

check out non-eclipse maven projects from git (file → import.. → maven → check out maven projects from scm)

file → import.. → maven → check out maven projects from scm

now add your git repository link to scm uri field.then click next & finish.


i would perform a git clone via the command line (outside eclipse) then use file -> import... -> existing maven projects.

your projects will be understood as using git and maven. it's the fastest and most reliable way to import imo.


eclipse indigo + m2eclipse 1.0 makes it very easy.

if you don't already have the git connector for m2eclipse install it. m2eclipse will help you along by prompting you on the import menu.

  1. select the "import..." context menu from the package explorer view
  2. select "check out maven projects from scm" option under the maven category
  3. on the window that is presented choose the link "find more scm connectors in the m2e marketplace
  4. find connector for git...install...restart

note that in the search box you may have to enter "egit" instead of "git" to find the right connector.

with that done, simply go to the egit repository, bring up the context menu for the working directory and select "import maven projects...".


Related Query