An automatically install git hook practicable sample in maven.
- Clone this repo, you can treat it as a simple project of you.
- Run either
mvn clean package
ormvn clean install
like other mvn project. - Now,
git commit
any changes, you should find it will auto runmvn test
as thepre-commit
hook.
It just simply rewrite the .git/hooks/<hook>.sample
to .git/hooks/<hook>
and write custom hook content (mvn test
) into it.
It will be triggerred on mvn clean
phase via the exec-maven-plugin
.
The git hook script GitHook.java
located in /githook
.
You can do the trick on your own projects now. 🐶