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.

Open in generator Open with Java, JetBrains, macOS

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

PatternWhat 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.propertiesRelease 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.versionsBackupVersions plugin backupThe original backup that versions-maven-plugin leaves before versions:set.
dependency-reduced-pom.xmlbuildNumber.propertiesPlugin-generated filesThe reduced POM created by maven-shade-plugin and the number file of the buildnumber plugin.
.mvn/timing.propertiesLocal measurementsBuild timing results; the values differ per person.
.mvn/wrapper/maven-wrapper.jarWrapper 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.classpathEclipse m2e filesProject files that Eclipse generates from the POM.

Practical notes

Original template

Maven.gitignore12 rules
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

Often used together

More template explanations