.gitignore for Gradle + Java
.gitignore for Java projects using Gradle as the build system.
Quick presets
Selected (2)
GradleJava
Your selections never leave your browser. Generation happens entirely client-side.
19 patterns · 380 B
# Generated by DevZone Tools — https://devzone.tools/tools/gitignore-generator # Templates: Java, Gradle # 2026-04-20 # ---- Java ---- # Java *.class *.log *.ctxt .mtj.tmp/ *.jar *.war *.nar *.ear *.zip *.tar.gz *.rar hs_err_pid* replay_pid* # ---- Gradle ---- # Gradle .gradle/ **/build/ !src/**/build/ !gradle/wrapper/gradle-wrapper.jar local.properties *.gradle.kts.~lock~
Why use Gradle + Java together?
Gradle is one of the two dominant Java build tools. The Gradle template covers .gradle/ caches and build/ output. Combined with Java's .class and archive patterns, this gives complete coverage for Gradle-based Java projects.
Related combinations
Frequently asked questions
- Do I need to commit .gitignore?
- Yes — .gitignore should be committed to the repository so all collaborators benefit from the same ignore rules.
- How do I add custom patterns?
- Open your .gitignore file and add the pattern on a new line. Use # for comments, * for wildcards, / to match directories, and ! to un-ignore a previously ignored path.
- How do I ignore a file that is already tracked?
- Adding a file to .gitignore does not remove it from tracking if it was previously committed. Run: git rm --cached <file> to stop tracking it without deleting the file locally.
- Why combine Gradle and Java?
- Gradle is one of the two dominant Java build tools. The Gradle template covers .gradle/ caches and build/ output. Combined with Java's .class and archive patterns, this gives complete coverage for Gradle-based Java projects.
Looking for something else? Browse all templates →