Some custom gradle hooks for pre-commit.
See also: https://github.com/pre-commit/pre-commit-hooks
Add this to your .pre-commit-config.yaml
- repo: https://github.com/jguttman94/pre-commit-gradle
rev: v0.2.1 # Use the ref you want to point at
hooks:
- id: gradle-check
# - id: ...
gradle-check
- Run gradle unit test tasks- Use gradlew (gradle wrapper)
args: ['-w', --wrapper]
. - Print output from gradle command
args: ['-o', --output]
.
- Use gradlew (gradle wrapper)
gradle-build
- Run gradle build tasks- Use gradlew (gradle wrapper)
args: ['-w', --wrapper]
. - Print output from gradle command
args: ['-o', --output]
.
- Use gradlew (gradle wrapper)
gradle-spotless
- Run gradle spotless tasks for java linting- Require spotless plugin: github
- Use gradlew (gradle wrapper)
args: ['-w', --wrapper]
. - Print output from gradle command
args: ['-o', --output]
.
gradle-task
- Run any arbitrary gradle commands- Provide task name(s) to execute via arguments
args: ['clean build bootRun']
- Use gradlew (gradle wrapper)
args: ['-w', --wrapper]
. - Print output from gradle command
args: ['-o', --output]
.
- Provide task name(s) to execute via arguments