What files should be committed to github for an eclipse project - eclipse

What files should I commit to github so that its a valid Eclipse project ?
I am just committing my source files and packages but when I try to re-create the project I receive this error 'no projects found' :
I think I need to also commit the .project file ?

You need to commit your:
.settings dir
.classpath file
.project file
The better idea will be to use maven for your project so that
you will have a common configuration for all the IDEs (eclipse, netbeans, ideaj ...) and no need to push your eclipse specific configuration.

For a typical Java SE Eclipse project, you must commit .project and .classpath files, but not necessary .settings folder. I tested this scenario by committing one project from my windows environment and cloning that onto my Linux environment; Eclipse imported and run this project without any error. Hope this tip helps you reduce committing one folder (the .setting).

Related

Using a separated source folder from SVN on Eclipse

So, here in the company we work with svn, and our svn server only have the source folder. When I use NetBeans, it's everything ok because I can add source folders in project and will work fine in svn. But on eclipse if i do the checkout from command line and add that folder in my dynamic web project, I can't see the svn history and nothing, svnclipse just does not work on that folder.
Our structure of the projects it's something like this
Workspace
Project folder
Project1
Project configuration files
SourceCode
Packages
Project folder 2
Project2
SourceCode
I already try to make checkout using svnclipse, but he add alot of extra config files, he turns the folder in a project and the source folder is add as a link to another project, in this scenario the svnclipse quick diff does not work properly.
There is a way to use that folder as source and Svnclipse works on that ?
Sorry if my English is not so good
There is no easy way to do what you want. In Eclipse a source control provider can only be connected to the project itself. So options are:
Use another svn client like command line or TortoiseSVN.
Create a small SVN project with the Eclipse project configuration files that also use svn:externals to pull in your source folder from repository.
With option 2, you would checkout this small SVN project from some other repository using Subclipse in Eclipse, could even be a local file:// repository and then the svn:externals property would also cause your source folder to be checked out.

gitignore for folder of eclipse projects

I am working following a set of java swing tutorials, each is an Eclipse project, keep them in a workspace. I init a git repository in the workspace folder (mac), and upload to github. When I download this folder in another computer (linux), the projects are not recognized as such, and opening/importing in Eclipse fails. Says: 'Folder not recognized as project'. What is the best way to handle a collection of projects in git?
If you want to have all of your Eclipse project data across your machines, you will have to add the following files/folders to Git:
.classpath
.project
.settings (folder)
Make sure that these are not ignored in either your local or globale .gitignore files.
Ignore things like the bin and target folders, since they contain the compiled classes and shouldn't be added to Git.
Regarding the failed import: as #nwinkler writes, Eclipse looks for the .project and .classpath files so you need to add them (and the .settings directory) to your git repository.
Regarding .gitignore, I typically put the workspace stuff there (and then do import existing projects in eclipse after cloning):
That is,
.metadata/.plugins
.metadata/.lock
.metadata/.log
and then for each project, the bin folder
project_dir/bin
and any other generated files

m2e and project metadata files

I'm used to other IDEs such as Visual Studio which keep project structure on some metadata files. I'm using Eclipse right now and I used m2e eclipse to import a maven project. afaik Eclipse only gets source/resource files from pom.xml (or maven default directories if none is specified) and create the project tree.
Therefore, i think that, if I have the code and Eclipse configuration files (.project, .classpath) in a repository and I update code directory structure, no Eclipse files will be updated and therefore I don't need to update Eclipse files in the repository.
Is that correct?
Correct, you don't need to save the .project and ,class path files in a repository. The m2e commands "Update Project Configuration" and "Update Project Dependencies" will correct those files, respectively, once you've retrieved the rest of the source from the repository.
Generally, if you use m2e (recent versions) and a SCM (Git, Svn, CVS, etc.), you don't need to commit the Eclipse configuration files to the repository.
These main files are :
.project
.classpath
.settings/
There is a good example on GitHub of a .gitignore file which shows what files in Eclipse you don't need to commit.
EDIT :
To regenerate Eclipse project files, you can either :
Import > Existing Maven Projects : needed eclipse files are created
Import > Checkout Projects from SVN (or CVS, GIT, etc.) ..... if needed : Convert to Maven project
Use CLI maven-eclipse-plugin with mvn eclipse:eclipse (Goal) (not recommended if using m2e)

eclipse+bzr (Or: DVCS + IDE)

I have some projects on bzr code repositories shared with colleagues.
Problem is, I really want to switch to eclipse in some projects, but I don't want to pollute the repository with the unnecessary metadata eclipse creates in its Workspaces.
Any idea how to keep Eclipse's metadata outside my bzr repo?
Adam
If you know the names of the meta files created, you could put them into your .bzrignore file in your repository's directory.
See this part of the bzr docs
All the main metadata in eclipse are in the workspace.
You project, meaning:
your .project file
your .classpath file
your .settings directory
your source files
should all be located elsewhere, within your main project directory.
All those files (except the .class files generated by the compilation) should be versioned.
See "Do you keep your project files under version control?" for more, but also:
What to put under version control?
When working with Eclipse, should I add the workspace to the source control?

What should be committed to the repository in the Eclipse workspace?

I have a Eclipse installed to work with BIRT reports. What files in the workspace should be committed to the repository and what files should not?
Basically, any file able to help a developer checkout the repo and (almost) immediately open the project to work on it.
That should include at least eclipse files like .project, .classpath, and some IDE settings.
They might be some BIRT-specific settings as well.
See also:
Do you keep your project files under version control?
When working with Eclipse, should I add the workspace to the source control?