Fabio Oesch
Fabio Oesch

Reputation: 143

What is the correct way to have a Java Project with Eclipse on GitHub

I am working on a Java Project with Eclipse which we want to put on GitHub so that it is accessible for the public. But we are not entirly certain what is the correct way to put a Java Project onto GitHub. We have already made a GitHub and uploaded a Java Project. But when checked it out, with EGit, to my computer all the folders are now packages.

Is there any way how this can be avoided? How are you uploading a Java Project to GitHub? Are there any difficulties which we are not aware of right now?

Upvotes: 0

Views: 1187

Answers (2)

Nemesis
Nemesis

Reputation: 2918

I'd rather not upload .projects or .idea files while uploading projects to VCS system (git or not).

I add these folders to my .gitignore file (wich i upload to VCS)

Regards.

Upvotes: 0

ddavison
ddavison

Reputation: 29032

A good example I like to use, is my getting started with selenium project.

This is a Maven enabled Java Project that is hosted on github.

But when checked it out, with EGit, to my computer all the folders are now packages.

This is because of your .classpath. If a source folder is added, (like src/main/java) any subsequent folders will be "packages".

How are you uploading a Java Project to GitHub?

Just as you see in the project above. Upload everything, except binaries, and jar dependencies. (which is why i use Maven)

Are there any difficulties which we are not aware of right now?

Where I work, we use a process in which our projects on github are entire java projects. I've heard that it's bad to upload eclipse specific things like .project, but even individuals who use IntelliJ IDEA, it doesn't seem to be an issue, because they can just upload their .file.

One thing to keep in mind, is your .gitignore. Make sure that /target/classes/* and other java specific compilations are avoided as you want your repo to be only source code. (one thing i DID forget to do on that project above.. will fix ;))

Upvotes: 2

Related Questions