This repository serves as a template project for Java development, designed to demonstrate and standardize continuous integration (CI) and code quality practices for Java projects. It provides a ready-to-use configuration for automated builds, static analysis, and formatting checks.
-
Gradle-based build system
- Java compilation, testing, and packaging.
- ErrorProne static analysis integrated.
- PMD and SpotBugs for code quality checks.
-
Code formatting and style enforcement
- Spotless with Google Java Format (AOSP variant).
- Checkstyle for consistent coding style.
-
Pre-commit hooks
- Ensures code quality checks run automatically before commits.
- Cross-platform support (Windows, macOS, Linux).
- Includes hooks for formatting, linting, and other safety checks.
-
GitHub Actions CI workflow
- Automatically runs all code quality and build checks on pull requests.
- Uploads reports for easy inspection.
- Demonstrates a modern CI/CD setup for Java projects.
- Java 25+
- Gradle (wrapper included)
- Python 3.8+ (for
pre-commit) - Pre-commit: Install via
pip install pre-commit
- Install pre-commit hooks:
python -m pre_commit install- Run all pre-commit checks manually (optional):
python -m pre_commit run --all-files --verbose- Run all code quality checks:
./gradlew codeQualityThe codeQuality task aggregates Spotless, Checkstyle, SpotBugs, and PMD checks in a single step.