Eclipse overrides existing project files when impo

2019-07-27 07:51发布

问题:

I'm working on an existing project from my wd of git. .classpath and default.properties files are on the repository.

When I import the project to Eclipse, my default.properties is replaced by a project.properties (the files' contents are the same) and my .classpath is modified.

As I said, these files are on the repository, so my git status is never clean.

Do you know how to force Eclipse using the files provided on the repository without modifying them ?

Thanks

回答1:

default.properties (or project.properties)

Check out the changelog of SDK r14 release:

default.properties which is the main project’s properties file containing information such as the build platform target and the library dependencies has been renamed project.properties

If someone from your development team still use a version older than r14, better to ask them upgrade to latest Android SDK version on their workstation, as the Android SDK has been changed rapidly since r14 regarding to project property file, library project, external jar dependency structure and etc. It will make development very hard to maintain if developers use different Android SDK version in a team.

If this is not an option in a short term, you should temporarily create and check-in both default.properties and project.properties (with the same contents) for a short period of time, to support old Android version in a short term and give other people time to upgrade their workstation.


.classpath

It is a very bad practice to commit IDE generated files (.classpath, .project and etc.) into source control. Do you expect .classpath generated from a Windows box has exact the same contents as the one generated from a Mac box? You should add .classpath to your source control ignore list so that it is ignored automatically whenever you commit your project to source control.

When use a source control system, Don't consider too much for every single commit, as long as you provide fully detailed comments. as every single action (add, modified, deleted and etc.) you did on every single file (java source, properties and resources file and etc.) in your project are logged and tracked in source control, in case if something goes wrong, it is quite easy for a sophisticated developer to track the change and revert the project into a normal state. Hope this helps.