SaintGeorge SaintGeorge - 4 months ago 23
Java Question

Example of gitignore file for java

Can you show me example of

.gitignore
file for java, that consider a lot of different files that are not included(jar, war, classpath, files that IDEA and other IDE generates and so on and on). I mean really big
.gitignore
.

What I currently have is

**/target/
/target/
*/target/*
.classpath
.project
.settings

# Package Files #
*.jar
*.war
*.ear

*.iml
*.idea

Answer

You can get sample java gitignore files at https://github.com/github/gitignore/blob/master/Java.gitignore

Based on the comments , here is a gist of the sample gitignore class

*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
Comments