Skip to content

Add .gitignore for Spring project files#4804

Open
JitenRaj wants to merge 1 commit intogithub:mainfrom
JitenRaj:main
Open

Add .gitignore for Spring project files#4804
JitenRaj wants to merge 1 commit intogithub:mainfrom
JitenRaj:main

Conversation

@JitenRaj
Copy link

Reasons for making this change

Currently, the Java.gitignore provided in this repository focuses on core language artifacts but misses several critical files generated by the Spring Boot ecosystem and its integration with modern build tools (Maven/Gradle).

This new Spring.gitignore template provides:

  • Build Tool Support: Specific ignores for Maven and Gradle wrappers and their temporary build directories (target/, build/).
  • Spring Boot Specifics: Filtering out .sts4-cache, .springBeans, and local configuration files (.env, *.properties.local) that often contain sensitive secrets.
  • IDE Integration: Support for Eclipse (STS), IntelliJ, and VS Code, which are the primary IDEs for Spring development.

Adding this as a standalone template allows developers to git init Spring projects with a "batteries-included" ignore file that prevents accidental commits of binary dependencies and local secrets.

Links to documentation supporting these rule changes

  • Spring Boot Reference Guide: Executable Jar Layout (explains why target/ and build/ must be ignored).
  • Spring Initializr (start.spring.io): The official Spring project generator includes a .gitignore by default; this PR aligns with the community standard set by the Spring team.
  • Baeldung - Guide to Gitignore for Java: Standard Java/Spring Ignore Patterns.

@JitenRaj JitenRaj requested a review from a team as a code owner February 26, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant