• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best practice for checking an Eclipse project into Git?

 
Scott Shipp
Ranch Hand
Posts: 194
10
Eclipse IDE IntelliJ IDE Java Scala Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am interested in creating a Git repo for an Eclipse project (which is a Java Dynamic Web Project on top of Tomcat if that matters). Are there any sharp edges to watch out for with this? Will the checkin preserve project properties? Any suggestions on how to use eGit to easily do this?

This is a very lightweight sample app so there is no build script or tool. All it's got is one HTML file with JQuery and Mustache referring to a servlet. But it does use JSON.org Java classes.
 
Stephan van Hulst
Bartender
Pie
Posts: 5889
63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't really want anyone cloning the project to have to worry about manually downloading anything else to be able to compile and run the application. For example, I used to check in third party libraries that my code used. I tried to minimize IDE specific project files though.

Personally I love the combination of Maven and Git. That way all I have to worry about are the program sources, documents and the POM. Almost no clutter!
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like checking in the Eclipse project files also, that way I can set up certain project settings (formatting, warnings, etc.) and be assured that everyone working on the project will use the same settings.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34669
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scott Shipp wrote:I am interested in creating a Git repo for an Eclipse project (which is a Java Dynamic Web Project on top of Tomcat if that matters). Are there any sharp edges to watch out for with this? Will the checkin preserve project properties?

Yes, the checkin will preserve project properties. Assuming someone other than you is working on this project, make sure the following are true:
1) Everyone working on the project has a similar version of Eclipse. If you are on Eclipse 4.2 and your teammate is on Eclipse 1.0, that isn't likely to go well.
2) Your Eclipse project is self contained. Put jar files it uses in the same project so they go in git. And avoid absolute paths.
 
Marshall Blythe
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan van Hulst wrote:Personally I love the combination of Maven and Git. That way all I have to worry about are the program sources, documents and the POM. Almost no clutter!


Agreed: I've been doing this with SVN instead of Git, but the end result is the same. The m2e plugin for Eclipse does a nice job of generating the various Eclipse project files from the POM.
 
Scott Shipp
Ranch Hand
Posts: 194
10
Eclipse IDE IntelliJ IDE Java Scala Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all the tips everyone.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic