Spring in Practice

Willie Wheeler's Spring blog

Mavenizing an Empty GitHub Project in Eclipse

| Comments

This post is for myself more than anything else, just because I keep forgetting the steps involved.

I’m using SpringSource Tool Suite 2.9.1.RELEASE, which is based on Eclipse 3.7.2 (Indigo). I have the egit and m2e Eclipse plugins installed.

The scenario

You have a brand new, pretty-much-empty GitHub project (other than the README, say—but no Maven stuff yet), and you want to import it into Eclipse as a Maven project.

The steps

  1. Add the remote GitHub repo to your list of Git repos in Eclipse.
  2. In Eclipse, go to File → Import → Git → Projects from Git. (I’m on a Mac; the menu may be a little different for other platforms.)
  3. On the “Select Repository Source”, choose “URI”.
  4. On the “Source Git Repository” pane, enter the URI info. It might be something like ssh://git@github.com/williewheeler/sip11.git, for example.
  5. On the “Branch Selection” pane, choose the master branch.
  6. On the “Local Destination” pane, decide where you want the local copy to live.
  7. Where it asks you to select an import wizard, choose “Use the New Project wizard” and click “Finish”.
  8. Now you have to choose a New Project wizard. Choose Maven → Maven Project.
  9. From here just create the project like you would any other new Maven project. Once you’re done, it will show up in your list of projects in the Package Explorer view, and sharing should be activated.