File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes Best practice for checking an Eclipse project into Git? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Best practice for checking an Eclipse project into Git?" Watch "Best practice for checking an Eclipse project into Git?" New topic
Author

Best practice for checking an Eclipse project into Git?

Scott Shipp
Ranch Hand

Joined: Mar 31, 2013
Posts: 122
    
    6

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

Joined: Sep 20, 2010
Posts: 3646
    
  16

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

Joined: May 14, 2008
Posts: 5827
    
    7

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.


JBoss In Action
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30506
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Marshall Blythe
Ranch Hand

Joined: Feb 26, 2013
Posts: 32
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

Joined: Mar 31, 2013
Posts: 122
    
    6

Thanks for all the tips everyone.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best practice for checking an Eclipse project into Git?