在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):olukyrich/githook-maven-plugin开源软件地址(OpenSource Url):https://github.com/olukyrich/githook-maven-plugin开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):githook-maven-pluginMaven plugin to configure and install local git hooks Protect your VCSIt's always a good idea to check your changes before committing them: run unit tests, perform the build, etc. However, such check-lists may be easily overlooked, especially in big projects. To get rid of the human factor, they should be somehow forced and automated. The best way is to implement such verification on the project infrastructure level. However, sometimes there's no infrastructure or it doesn't allow to implement that. For the latter there are git client hooks. Listen to your VCSBesides pre-commit and pre-push hooks there are some others which allow to handle local VCS events. Drawbacks of local git hooksThe main disadvantage of this approach is that hooks are kept within .git directory, which shall never come to the remote repository. Thus, each contributor will have to install them manually in his local repository, which may, again, be overlooked. So why should I use this plugin?Because it deals with the problem of providing hook configuration to the repository, and automates their installation. ImplementationThe idea is to keep somewhere a mapping between the hook name and the script, for each hook name create a respective file in .git/hooks, containing that script when the project initializes. "Initializes" -- is quite a polymorphic term, but when it's a maven project, then it likely means initial lifecycle phase. In the majority of cases, it will be enough to map the plugin on "initialize" phase, but you can still create any other custom execution. FlawsObviously, nothing can restrain one from the cloning of repository, and interacting with it without initial build. Also, it's always possible to delete hook files manually. UsageThe plugin provides the only goal "install". It's mapped on "initialize" phase by default. To use the default flow add these lines to the plugin definition:
To configure hooks provide the following configuration for the execution:
NOTE: The plugin rewrites hooks. Usage ExampleSimple usage with inline script :
External hook files can also been used :
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论