Build scripts - don't modify my files!
2014-08-06One of my pet hates when it comes to development is a build script or an IDE that modifies project/config files so that the project looks like it’s modified in the IDE.
When I check out a project from source control, whether it be Subversion, Git, Mercurial… whatever, until I physically open and edit a (not ignored) file in that project, I only want to see that little yellow cylinder looking thing.
So here’s a few Don’ts to follow:
- Don’t check in IDE generated files that might be modified by somebody else’s specific IDE settings (and re-checked-in). I’m talking Eclipse .project, .classpath, and .settings/ for example.
- Don’t let your build scripts modify source controlled files that someone may inadvertently check in with incorrect, build generated content.
And some Dos:
- Do use a plugin that generates IDE configuration files (.project, .classpath, .settings/ etc. in Eclipse). If you’re using Maven + Eclipse, use m2e. Gradle? Use the Gradle Eclipse/Intellij IDEA plugin.
- Do create new files with build specific properties you need to generate content for properties files
- Do mark all of the plugin generated files and folders as ignored in your subversion properties, .gitignore etc.
There’s a good answer over on stackoverflow which discusses this topic which is definitely worth a read.
Your thoughts? I'd love to hear them. Please get in contact.