What files are unnecessary when exporting an Eclipse Workspace to a version control repository?
I have a few Android and Java projects under a single Eclipse workspace and would like to export the complete workspace to my own version control repository. I would like to keep the files being exported to a minimum. As such, other than the resource history and the JDT caching as mentioned by this article, is there any other files that do not need to be exported?
Note that a subsequent export of the imported workspace should result in a working build without adding additional files that are not already in the repository.
Under the [workspace]/.p开发者_开发技巧lugins/.metadata directory, I have the following directories
- org.eclipse.core.resources
- org.eclipse.core.runtime
- org.eclipse.debug.core
- org.eclipse.debug.ui
- org.eclipse.epp.usagedata.recording
- org.eclipse.equinox.p2.ui
- org.eclipse.jdt.core
- org.eclipse.jdt.debug.ui
- org.eclipse.jdt.junit.core
- org.eclipse.jdt.launching
- org.eclipse.jdt.ui
- org.eclipse.ltk.core.refactoring
- org.eclipse.ltk.ui.refactoring
- org.eclipse.mylyn.bugzilla.core
- org.eclipse.mylyn.tasks.ui
- org.eclipse.team.cvs.core
- org.eclipse.ui.ide
- org.eclipse.ui.intro
- org.eclipse.ui.workbench
- org.eclipse.ui.workbench.texteditor
- org.eclipse.wst.internet.cache
- org.eclipse.wst.sse.ui
- org.eclipse.wst.xml.core
Typically you will only be storing files under version control that are required for successfully building the application. But to help with development in large teams it is also typical (though not best practice) to store the bare minimum meta data required to reconstruct the Java project in the teams IDE of choice. So to sum up, from Eclipse you would want to export:
- All Java source files and folders
- All web application source files and folders
- All custom source files and folders (i.e folders created by you with XML files etc)
- The .project and .classpath files for your top level Eclipse project
You definitely do not want to export any Eclipse specific files/folders like .plugins. If you want a hard and fast guide, you should export to your VCS, any files/folders needed to build your application, imagining that the development could happen in any IDE. Using that hard and fast rule you can easily determine what to store, and it also becomes obvious that storing the .classpath and .project in VCS are really just crutches to speed up setting up a new Eclipse with your application faster. It's your judgement call really wether to include those two files.
The only directories/files you need in your repo for most projects are:
res/
src/
assets/ (if used)
AndroidManifest.xml
default.properties
I think the simple answer is that you'll need to include all of the files if you want to be able to rebuild the workspace accurately. They aren't going to take a lot of space up in any case.
If you start checking in just pieces of the workspace, you would need to talk to the eclipse developers to ascertain that there will be no unknown side affects to that. It's not really worth it.
If it helps, I work on a lot of projects using eclipse and we don't check in the workspace at all.
Rebuilding the workspace from scratch isn't generally a problem and happens automatically.
精彩评论