做好对外门户网站建设,网站建设制作设计seo优化珠海,seo系统是什么,上海网络建设公司git 提交代码#xff0c;推送代码#xff0c;可以通过在 .git/hooks 目录中的 bash 脚本来做一定的验证工作。
本例使用插件 maven-antrun-plugin 自动输出脚本至 .git/hooks 目录中#xff0c;在 pom.xml 中的使用示例如下#xff1a; plugingroupIdorg.…git 提交代码推送代码可以通过在 .git/hooks 目录中的 bash 脚本来做一定的验证工作。
本例使用插件 maven-antrun-plugin 自动输出脚本至 .git/hooks 目录中在 pom.xml 中的使用示例如下
plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-antrun-plugin/artifactIdexecutionsexecutionidgen-gitbash-clean/idphaseclean/phasegoalsgoalrun/goal/goals/executionexecutionidgen-gitbash-compile/idphasecompile/phasegoalsgoalrun/goal/goals/execution/executions!-- configuration没有放在execution里面是让多个execution都能执行 --configurationtarget!-- 生成commit-msg文件 --echo file${basedir}/.git/hooks/commit-msgmessage#!/usr/bin/env bash${line.separator}${line.separator}/echo file${basedir}/.git/hooks/commit-msg appendtruemessage# Color codes${line.separator}red\033[0;31m${line.separator}yellow\033[0;33m${line.separator}blue\033[0;34m${line.separator}NC\033[0m # No colors/echo file${basedir}/.git/hooks/commit-msg appendtruemessage${line.separator}${line.separator}/echo file${basedir}/.git/hooks/commit-msg appendtruemessage# Regex amp; Usage${line.separator}commit_regexquot;^(\[[A-Za-z]\-[0-9]\]|merge|Merge)\squot;${line.separator}error_messagequot;Aborting commit. Commit message must start with ${yellow} 开发任务编号quot;${line.separator}usagequot;开发任务编号 Commit Message. \n${blue}示例: [TASK-101] 完成A功能开发quot;/echo file${basedir}/.git/hooks/commit-msg appendtruemessage${line.separator}${line.separator}/echo file${basedir}/.git/hooks/commit-msg appendtruemessageif ! grep -qE quot;$commit_regexquot; quot;$1quot;; then${line.separator}/echo file${basedir}/.git/hooks/commit-msg appendtruemessage printf quot;${red}$error_message\nquot;${line.separator}/echo file${basedir}/.git/hooks/commit-msg appendtruemessage printf quot;${yellow}Commit Regex: ${NC}${commit_regex}\nquot;${line.separator}/echo file${basedir}/.git/hooks/commit-msg appendtruemessage printf quot;${red}Usage: ${NC}${usage}\nquot;${line.separator}/echo file${basedir}/.git/hooks/commit-msg appendtruemessage exit 1${line.separator}fi/!-- 生成pre-push文件 --echo file${basedir}/.git/hooks/pre-pushmessage#!/usr/bin/env bash${line.separator}${line.separator}/echo file${basedir}/.git/hooks/pre-push appendtruemessage# Color codes${line.separator}red\033[0;31m${line.separator}yellow\033[0;33m/echo file${basedir}/.git/hooks/pre-push appendtruemessage${line.separator}${line.separator}/echo file${basedir}/.git/hooks/pre-push appendtruemessagecommandquot;./mvnw.cmd clean testquot;${line.separator}${command}/echo file${basedir}/.git/hooks/pre-push appendtruemessage${line.separator}${line.separator}/echo file${basedir}/.git/hooks/pre-push appendtruemessageif ! [ $? -eq 0 ]; then${line.separator}/echo file${basedir}/.git/hooks/pre-push appendtruemessage printf quot;${red}Make sure successfully execute command: ${yellow}$command${red}.quot;${line.separator}/echo file${basedir}/.git/hooks/pre-push appendtruemessage exit 1${line.separator}fi/!-- 设置权限 --chmod dir${basedir}/.git/hooks perm755 includes**/*//target/configuration/plugin在执行maven的 clean 或者 compile 时候插件会自动输出 commit-msg 和 pre-push 两个脚本文件 END