Eclipse Git plugin installation
Friday, June 27th, 2008Like a lot of Rails developers who have been spoiled by the excellent Eclipse plugins for Subversion, I was disappointed by the lack of equivalent plugins for Git. In fact, the only one that I found was Egit. Unfortunately, its documentation is a bit weak. And for someone who is not a Java guru, Eclipse guru and/or a mind reader, the installation instructions are really weak. But I was desperate. And once I dove in, it turned out to not be that difficult.
Assumptions (most directly from Egit’s sparse installation guide):
- You have git installed and working correctly
- I have version 1.5.5.4
- You can see your version from the command line with git –version
- You have Eclipse installed and working correctly
- I use Europa, version 3.3.2
- From within Eclipse you can see your version with Eclipse | About Eclipse SDK (OSX) or Help | About (Windows).
- Java Runtime Environment (JRE) version 6 or 1.5.0_11 or later available
- My MacBook Pro came pre-installed with version 1.5.0_13
- You can see which version you have from the command line with java -showversion -it’s at the top. But that only shows one JRE version, and…
- Because it’s possible to have multiple JREs installed, you should also check your Eclipse preferences to make sure you have an appropriate version available from within Eclipse. You can see the JRE Interpreters with Java > Installed JREs. The checked JRE is the default, but the Egit plugin only cares that a suitable version is available.
The installation steps are pretty straightforward:
- Clone (or otherwise acquire) the Egit source and put it somewhere. I used this command: git clone git://repo.or.cz/egit.git
- Inside the Egit source are several Eclipse projects, each in a directory whose name starts with “org.spearce.” You need to add these projects into your Eclipse environment -but only temporarily. You can add them from the File | Import menu option in Eclipse. Then select General > Existing Projects into Workspace. From the dialog box browse to the directory holding the Egit source that you acquired in step one above. You should then see the eight Eclipse projects “org.spearce.<something>.” Make sure they are all selected and choose “Finish.”
- Each project should build automatically, but in case you have somehow disabled automatic building, manually build the Egit projects from the Project menu.
- Next, you’re going to create an Eclipse plugin from the built projects:
- From the Project Explorer (or Ruby Explorer) view, select (highlight) all eight Egit projects
- Choose File | Export from the Eclipse menu
- Choose Plug-in Development > Deployable plug-ins and fragments. If you don’t see the Plug-In Development section,you need to enable the Development capability in the Eclipse Preferences (General > Capabilities).
- Select “Next” and in the resulting “Export” dialog, make sure you have selected all five available Plug-ins and fragments
- Browse to the root directory of your Eclipse installation. On OSX, the directory is typically Applications/Eclipse. Under Windows, I would expect something like C:\Program Files\Eclipse or C:\Eclipse.
- Select “Finish”
- Now that you have added the Egit plugin, you need to restart Eclipse to enable it.
You’re done.
Add Git features to an existing project from the “Team” menu.
Issues:
- Where are all the pretty decoration icons for git status? All I have are nasty ‘>’ characters.