github/gitignore · Maven.gitignore
Maven .gitignore Template Explained
Why Maven.gitignore ignores the target folder, release plugin backups, shade plugin output, the Maven wrapper jar and Eclipse files.
Maven.gitignore blocks files Maven creates during builds and releases. The tool is designed so that all output ends up in target/, so the rules are simple.
For the Maven wrapper, the currently recommended approach is to commit mvnw, mvnw.cmd and .mvn/wrapper/maven-wrapper.properties and to ignore the jar as the template does. The wrapper script downloads the jar or the Maven distribution when needed.
Rules explained
| Pattern | What it ignores and why |
|---|---|
target/ | Build outputThe standard output folder that collects compiled classes, test results and packaged jars and wars. It is deleted with mvn clean and rebuilt. |
pom.xml.tagpom.xml.releaseBackuppom.xml.nextrelease.properties | Release plugin filesBackups and progress files that maven-release-plugin creates during release:prepare. They are no longer needed once the release completes or is rolled back. |
pom.xml.versionsBackup | Versions plugin backupThe original backup that versions-maven-plugin leaves before versions:set. |
dependency-reduced-pom.xmlbuildNumber.properties | Plugin-generated filesThe reduced POM created by maven-shade-plugin and the number file of the buildnumber plugin. |
.mvn/timing.properties | Local measurementsBuild timing results; the values differ per person. |
.mvn/wrapper/maven-wrapper.jar | Wrapper jarA binary the wrapper script can download when needed. The Maven Wrapper documentation linked from the template explains how to use it without the jar. |
.project.classpath | Eclipse m2e filesProject files that Eclipse generates from the POM. |
Practical notes
.mvn/maven.configand.mvn/jvm.confighold shared team build options, so commit them. This template does not ignore these two files.- If you put repository passwords in
settings.xml, keep it in~/.m2/settings.xml, not in the project. - If you use IntelliJ, also select the JetBrains template.
Original template
Maven.gitignore
target/pom.xml.tagpom.xml.releaseBackuppom.xml.versionsBackuppom.xml.nextrelease.propertiesdependency-reduced-pom.xmlbuildNumber.properties.mvn/timing.properties# https://maven.apache.org/tools/wrapper/#Usage_with_or_without_Binary_JAR.mvn/wrapper/maven-wrapper.jar# Eclipse m2e generated files# Eclipse Core.project# JDT-specific (Eclipse Java Development Tools).classpath
Templates from github/gitignore/Maven.gitignore @356fd7b (2026-09-11) · CC0-1.0