Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Using Eclipse (Windows) with git plugin
Using Eclipse (Windows) with git plugin [message #993497] Mon, 24 December 2012 10:58 Go to next message
Dennis Putnam is currently offline Dennis Putnam
Messages: 52
Registered: January 2012
Member
I have installed the git plugin on Eclipse (Juno) in order to put a Java project under version control. I have a working central repository on a Linux server. I was able to clone that to a repository on my Windows development machine using the plugin. I can edit the files in Eclipse, stage them and push them upstream. Unfortunately that environment does not let me debug changes as the Run as Application menu selection is missing. I made a guess that I need yet a 3rd copy for for debugging and that is where I'm stuck. I tried doing a File->Import->Projects from Git->local->localgitdirectorypath->awizard. It is the wizard selection where things fall apart. I can't use Import existing projects because no projects can be found (I assume it is looking for Eclipse projects which do not exist in the repository). I tried using Use New Project Wizard but that did not import the repository and just gave me an empty project. What am I doing wrong or do I need to do something different to debug my app in the repository view and not bother with a 3rd copy? TIA.
Re: Using Eclipse (Windows) with git plugin [message #993531 is a reply to message #993497] Mon, 24 December 2012 13:23 Go to previous messageGo to next message
David Wegener is currently offline David Wegener
Messages: 1336
Registered: July 2009
Senior Member
Have you included the .classpath and .project files when checking the project into the repository. These define the project type and how to compile/run it.
Re: Using Eclipse (Windows) with git plugin [message #993537 is a reply to message #993531] Mon, 24 December 2012 13:41 Go to previous messageGo to next message
Dennis Putnam is currently offline Dennis Putnam
Messages: 52
Registered: January 2012
Member
Thanks for the reply. No, I didn't think they should be included, at least on the central repository since they only apply to Eclipse and my Eclipse at that. Would collaborators necessarily use the same one? Can/should I put them on the local repository but have them excluded from the central? I haven't played much with .gitignore but what little I have tried doesn't seem to work.

[Updated on: Mon, 24 December 2012 13:42]

Report message to a moderator

Re: Using Eclipse (Windows) with git plugin [message #993690 is a reply to message #993537] Tue, 25 December 2012 01:30 Go to previous messageGo to next message
David Wegener is currently offline David Wegener
Messages: 1336
Registered: July 2009
Senior Member
On 12/24/2012 12:41 PM, Dennis Putnam wrote:
> No, I didn't think they should be included, at least on the central
> repository since they only apply to Eclipse and my Eclipse at that.
> Would collaborators necessarily use the same one? Can/should I put them
> on the local repository but have them excluded from the central? I
> haven't played much with .gitignore but what little I have tried doesn't
> seem to work.
If you want to develop using Eclipse, you need to have these files. I
would recommend that you put them in the central repository so that
other developers can use Eclipse as well.

You can use features like Class Path Variables and Linked Resources to
define relative locations to any files external to the project. This
makes it easier to share the project. Locations become relative instead
of explicit.
Re: Using Eclipse (Windows) with git plugin [message #993692 is a reply to message #993537] Tue, 25 December 2012 01:32 Go to previous message
Russell Bateman is currently offline Russell Bateman
Messages: 3157
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 12/24/2012 11:41 AM, Dennis Putnam wrote:
> No, I didn't think they should be included, at least on the central
> repository since they only apply to Eclipse and my Eclipse at that.
> Would collaborators necessarily use the same one? Can/should I put them
> on the local repository but have them excluded from the central? I
> haven't played much with .gitignore but what little I have tried doesn't
> seem to work.

Without .project and .classpath, it's not really an Eclipse project. You
must have them.

I understand what you're saying about collaborators using the same ones.
I had these identical concerns when I started off using source-code
control, Subversion, for Eclipse projects. I have done it the wrong way
and the right way. There should not be host-specific paths in either
file and both files should be committed and pushed all the way to origin
master.

You shouldn't have to worry about .project. All your collaborators
should be working on the same project from every point of view and not
adjusting the project independently from the others.

However, you do have to worry about .classpath. You must be careful not
to add library JARs, for instance, that lie outside your project. (If
using Maven, this shouldn't be a problem. I don't use Maven.)

Even when setting up Build Path with JARs from, say, a subdirectory
underneath your project (and therefore committed), it's possible to
generate host-dependent paths when you wire up source code or Javadoc
for the JARs in your classpath. If you're exceptionally interested in
this, see http://www.javahotchocolate.com/tutorials/git-eclipse.html .

So, yes, commit .project and .classpath changes to master and each
collaborator should pull them with no problem to his individual master
and branch copies.

..gitignore works pretty much as .svnignore and .cvsignore.

If you wish to exclude files or subdirectories, such as .class files
that are built by the compiler and should not be committed, just add the
path from the root of the repository (which is the same thing as the
root of the Eclipse project).
Previous Topic:Saving the Eclipse environment
Next Topic:C/C++ IDE
Goto Forum:
  


Current Time: Sat Aug 30 00:26:11 EDT 2014

Powered by FUDForum. Page generated in 0.01657 seconds