Skip to content

Instantly share code, notes, and snippets.

@dedunumax
Last active April 6, 2024 16:13
Show Gist options
  • Save dedunumax/54e82214715e35439227 to your computer and use it in GitHub Desktop.
Save dedunumax/54e82214715e35439227 to your computer and use it in GitHub Desktop.
A complete .gitignore file for Java.
##############################
## Java
##############################
.mtj.tmp/
*.class
*.jar
*.war
*.ear
*.nar
hs_err_pid*
replay_pid*
##############################
## Maven
##############################
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
pom.xml.bak
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
##############################
## Gradle
##############################
bin/
build/
.gradle
.gradletasknamecache
gradle-app.setting
!gradle-wrapper.jar
##############################
## IntelliJ
##############################
out/
.idea/
.idea_modules/
*.iml
*.ipr
*.iws
##############################
## Eclipse
##############################
.settings/
bin/
tmp/
.metadata
.classpath
.project
*.tmp
*.bak
*.swp
*~.nib
local.properties
.loadpath
.factorypath
##############################
## NetBeans
##############################
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
##############################
## Visual Studio Code
##############################
.vscode/
.code-workspace
##############################
## OS X
##############################
.DS_Store
##############################
## Miscellaneous
##############################
*.log
@ckzgraphics
Copy link

Useful gist 👍

You may add the following as well -

##############################

Visual Studio Code

##############################
.vscode/

@falktan
Copy link

falktan commented Mar 18, 2020

I thought VSCode doesn't create files. Let me check and I will change the file accordingly. Thanks a lot for the suggestion.

Apparently VSCode produces pretty much the same files as Eclipse.
It might be reasonable to adjust the comment from "Eclipse" to "Eclipse / VSCode".

@dedunumax
Copy link
Author

Useful gist 👍

You may add the following as well -

##############################

Visual Studio Code

##############################
.vscode/

Done!

@dedunumax
Copy link
Author

I thought VSCode doesn't create files. Let me check and I will change the file accordingly. Thanks a lot for the suggestion.

Apparently VSCode produces pretty much the same files as Eclipse.
It might be reasonable to adjust the comment from "Eclipse" to "Eclipse / VSCode".

Thanks a lot for the suggestion! I think they depend on the tools/extensions used with VSCode.

@joedatlive
Copy link

How about the work space files for VSCode?
*.code-workspace

@alvhix
Copy link

alvhix commented Apr 29, 2020

Thank you very much!

@dedunumax
Copy link
Author

How about the work space files for VSCode?
*.code-workspace

Done! :D

@ckzgraphics
Copy link

@dedunumax
Copy link
Author

Thanks a lot, @ckzgraphics! I personally believe checked in code should be IDE neutral. I don't like adding any file related to the .idea/ folder in the repository.

@ckzgraphics
Copy link

Yep, @dedunumax. Commented for better reach to the resource 😃

@dedunumax
Copy link
Author

Yep, @dedunumax. Commented for better reach to the resource 😃

Cool. :D

@belhassenessid
Copy link

thanks!

@serhiihoroshko
Copy link

Thanks!

@money-seoh
Copy link

Thank you very much for .gitignore example for java files. It helped me a lot.

@NedkaBlagoeva
Copy link

I'll definitely use it, thanks for sharing :)

@hasanhg
Copy link

hasanhg commented Sep 2, 2021

Thanks!

@gibrancastillo
Copy link

Thank you, one for all IDEs. :-)

@andresfeelip29
Copy link

ty;

@rr-cory-hartford
Copy link

Rad. Thanks :)

@OpaJaa
Copy link

OpaJaa commented Feb 8, 2022

Thanks! Using macOs, Netbeans and IntelliJ so good to have comprehensive ignoring :)

@Enter55
Copy link

Enter55 commented Feb 23, 2022

I needed it I only knew it from Visual studio

Thank you!

@ecivil
Copy link

ecivil commented Apr 29, 2022

Thanks ... nice job.
Can you add *.NavData ?

@GustavoJoaoSantos
Copy link

nice

@masadamsahid
Copy link

Its very helping me. Thanks a lot 👍

@BrandontheDev360
Copy link

Possibly add .env for environment variables?

@Crypter0
Copy link

Thank you, very nice.

@TonyGravagno
Copy link

Thank you for this list! Please add : ._.DS_Store

@ChanPyaeAung11
Copy link

this is amazing. thx u

@MorgooN
Copy link

MorgooN commented Jul 16, 2023

Awesome, thx

@MorgooN
Copy link

MorgooN commented Jul 17, 2023

Humble suggestion about adding .xml into INTELIDEA section. Thx again

@BenMcLean
Copy link

Humble suggestion about adding .xml into INTELIDEA section. Thx again

Leaving that out is intentional because .xml files often are supposed to be committed.

@Marat-Sadenov
Copy link

add please *.log

@dedunumax
Copy link
Author

I added log under a different section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment