Git ignore for Java/JVM projects


Github has this great project hosted on ... GitHub.  What so great about it? Well, it contains git-ignore files for various development environments and programming languages. This gives you a great starting point when creating a new project in any language and any environment.

So this is my starting git ignore on every new java project:

*target*
*.jar
*.war
*.ear
*.class

# eclipse specific git ignore
*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath


# Intellij 
.idea/
*.iml 
*.iws

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch



It covers maven based projects with eclipse and using of combination local.properties for overriding  other *.properties that I prefer. Additionally it removes all eclipse specific "settings" that I'm opposed to having them in version control since most of the time it makes no sense for them to be there since they are generated. It's my believe that never eclipse settings should be part of the version control since for almost all of them there are appropriate  maven plug-ins.
The same thing can also be done for InteliJ files.

Published on Jun 7, 2012 by Mite Mitreski
Updated on 6/07/2012 10:07:00 PM