Importing git checkout project into eclipse workspace

Note: for some reason this post still gets a lot of hits. My post much later might be more helpful.

Trying to figure out how best to import Android projects into eclipse, particularly from a version control checkout. I’ve had the same trouble with trying to use samples downloaded from book/tutorial sites. What I’m trying to do:

  • I want to locate the project in my eclipse workspace.
  • I don’t want eclipse-specific files in version control – those seem to cause problems when moving between different eclipse installations. Or, in the case of downloaded examples, these files aren’t provided.
  • Use git; other VCSs have Eclipse plugins to simplify this – git does too, but it seemed half-baked and I shouldn’t have to use a plugin to do this.

Problems:

  • If I check out the project outside my workspace, and then try to create a project in eclipse using that as source, eclipse does not move or copy it into the workspace; it uses the original location (which makes sense)
  • If I check out the project within my workspace, and then try to create a project using it as source, eclipse refuses because of the location.
  • If I use File -> Import -> General -> Existing projects into workspace, eclipse expects to see its project descriptors (that I deliberately excluded with .gitignore) and refuses the import.
  • No other options seem appropriate to doing this

Here’s one way to do it:

  1. Check out the project somewhere.
  2. Use the “create project” dialog to create an Android project using this location as source. This adds the requisite eclipse project descriptor files.
  3. Close the project and delete it (leaving the files in place of course).
  4. Move the project directory into the eclipse workspace.
  5. Use File -> Import -> General -> Existing projects to import the project directory – since the project files are there now, this works fine.

I wonder if I’m just nutty leaving the eclipse project files out of the checked-in version. But they just don’t seem to belong there, neh?

Advertisements

One Response

  1. […] have cause to revisit my post about importing a git checkout into Eclipse. I need to take a look at the Hibernate code, which is on github at […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: