.gitignore for Maven
12 ignore rules for Maven, ready to copy into your repository.
Build automation tool for Java projects
The complete .gitignore for Maven
# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-08-05 01:31:34 UTC
# Technologies: Maven
### Maven ###
# Maven build directory
target/
# Maven version backup
pom.xml.tag
# Maven release backup
pom.xml.releaseBackup
# Maven versions backup
pom.xml.versionsBackup
# Maven next version
pom.xml.next
# Maven release properties
release.properties
# Maven shaded POM
dependency-reduced-pom.xml
# Eclipse project file
.project
# Maven build number
buildNumber.properties
# Eclipse classpath
.classpath
# Maven timing data
.mvn/timing.properties
# Maven wrapper JAR
.mvn/wrapper/maven-wrapper.jar
What these Maven rules actually ignore
Every pattern below, and why it belongs in your .gitignore.
General
| Pattern | What it ignores |
|---|---|
target/ |
Maven build directory |
pom.xml.tag |
Maven version backup |
pom.xml.releaseBackup |
Maven release backup |
pom.xml.versionsBackup |
Maven versions backup |
pom.xml.next |
Maven next version |
release.properties |
Maven release properties |
dependency-reduced-pom.xml |
Maven shaded POM |
buildNumber.properties |
Maven build number |
.mvn/timing.properties |
Maven timing data |
.mvn/wrapper/maven-wrapper.jar |
Maven wrapper JAR |
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 Maven
- Copy the Maven 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.