.gitignore for Java + Spring Boot
.gitignore for Spring Boot applications covering Java compilation and Maven/Gradle build artifacts.
Quick presets
Selected (2)
JavaSpring
Your selections never leave your browser. Generation happens entirely client-side.
18 patterns · 349 B
# Generated by DevZone Tools — https://devzone.tools/tools/gitignore-generator # Templates: Java, Spring # 2026-04-20 # ---- Java ---- # Java *.class *.log *.ctxt .mtj.tmp/ *.jar *.war *.nar *.ear *.zip *.tar.gz *.rar hs_err_pid* replay_pid* # ---- Spring ---- # Spring target/ .gradle/ build/ application-local.properties application-local.yml
Why use Java + Spring Boot together?
Spring Boot applications produce several artifact types: .class files from the Java compiler, JAR/WAR archives from Maven or Gradle, and potentially Docker images. The target/ (Maven) or build/ (Gradle) directories contain all compiled output and should not be committed.
A subtle but important Spring-specific pattern is ignoring application-local.properties and application-local.yml — these are local development overrides that often contain database credentials or external API keys.
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 Java and Spring?
- Spring Boot applications produce several artifact types: .class files from the Java compiler, JAR/WAR archives from Maven or Gradle, and potentially Docker images. The target/ (Maven) or build/ (Gradle) directories contain all compiled output and should not be committed.
Looking for something else? Browse all templates →