.gitignore for Gradle
9 ignore rules for Gradle, ready to copy into your repository.
Build automation tool for multi-language software development
The complete .gitignore for Gradle
# Generated by LFGitignore - https://lfgitignore.com
# Created: 2025-12-10 08:48:04 UTC
# Technologies: Gradle
### Gradle ###
# Gradle cache directory
.gradle
# Gradle build directories
**/build/
!**/src/**/build/
# Gradle app settings
gradle-app.setting
# Gradle wrapper JAR (keep)
!gradle-wrapper.jar
# Gradle wrapper config (keep)
!gradle-wrapper.properties
# Gradle task cache
.gradletasknamecache
# Eclipse project file
.project
# Eclipse classpath
.classpath
What these Gradle rules actually ignore
Every pattern below, and why it belongs in your .gitignore.
General
| Pattern | What it ignores |
|---|---|
.gradle |
Gradle cache directory |
**/build/ |
Gradle build directories |
!**/src/**/build/ |
General |
Ignore Gradle GUI config
| Pattern | What it ignores |
|---|---|
gradle-app.setting |
Gradle app settings |
Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
| Pattern | What it ignores |
|---|---|
!gradle-wrapper.jar |
Gradle wrapper JAR (keep) |
Avoid ignore Gradle wrappper properties
| Pattern | What it ignores |
|---|---|
!gradle-wrapper.properties |
Gradle wrapper config (keep) |
Cache of project
| Pattern | What it ignores |
|---|---|
.gradletasknamecache |
Gradle task cache |
Eclipse Core
| Pattern | What it ignores |
|---|---|
.project |
Eclipse project file |
JDT-specific (Eclipse Java Development Tools)
| Pattern | What it ignores |
|---|---|
.classpath |
Eclipse classpath |
How to use this .gitignore for Gradle
- Copy the Gradle rules above, or download the file directly.
- Create a file named .gitignore at the root of your Git repository and paste the rules into it.
- If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
- Commit the .gitignore so everyone on the team shares the same rules.