GIT -- gitflow的maven插件(gitflow-maven-plugin)

2024-05-25 12:48
文章标签 maven 插件 git plugin gitflow

本文主要是介绍GIT -- gitflow的maven插件(gitflow-maven-plugin),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

参考:https://github.com/aleksandr-m/gitflow-maven-plugin
maven如何引入插件,详见上面的参考地址

用法:

命令说明
mvn gitflow:release-startStarts a release branch and updates version(s) to release version.
mvn gitflow:release-finishMerges a release branch and updates version(s) to next development version.
mvn gitflow:releaseReleases project w/o creating a release branch.
mvn gitflow:feature-startStarts a feature branch and optionally updates version(s).
mvn gitflow:feature-finishMerges a feature branch.
mvn gitflow:hotfix-startStarts a hotfix branch and updates version(s) to hotfix version.
mvn gitflow:hotfix-finishMerges a hotfix branch.
mvn gitflow:support-startStarts a support branch from the production tag.
mvn gitflow:helpDisplays help information.

分支模型详见博客:http://blog.csdn.net/gaopeng0071/article/details/78773499

以上的maven操作,都可以增加参数,来达到快捷方便的效果。如下
mvn -DpushRemote=true -DallowSnapshots=false gitflow:release-start
- DpushRemote:true的时候自动push到远端仓库
- DallowSnapshots:true的时候,允许创建的分支中存在*-SNAPSHOT的jar存在。
- DskipTestProject=true:跳过单元测试


如下目标参数引用官网的介绍

  • The gitflow:release-finish, gitflow:release and gitflow:hotfix-finish goals have skipTag parameter. This parameter controls whether the release/hotfix will be tagged in Git. The default value is false (i.e. the release/hotfix will be tagged).

  • The gitflow:feature-start goal has skipFeatureVersion parameter which controls whether the feature name will be appended to the project version or not. The default value is false (e.g. if the project version is 1.0.0-SNAPSHOT and feature name is feature_name then after the execution it will be 1.0.0-feature_name-SNAPSHOT).

  • The gitflow:feature-start goal has featureNamePattern parameter which allows to enforce naming of the feature branches with a regular expression. Doesn’t have effect if it isn’t set or left blank. By default it isn’t set.

  • All -finish goals have keepBranch parameter which controls whether created support branch will be kept in Git after the goal finishes. The default value is false (i.e. the supporting branch will be deleted). If the pushRemote parameter is set to true and keepBranch is false remote branch will be deleted as well.

  • All -finish goals and gitflow:release have skipTestProject parameter which controls whether Maven test goal will be called before merging branches. The default value is false (i.e. the project will be tested before merging branches).

  • All release goals have allowSnapshots parameter which controls whether SNAPSHOT dependencies are allowed. The default value is false (i.e. build fails if there SNAPSHOT dependency in project).

  • The gitflow:release-finish and gitflow:release goals have digitsOnlyDevVersion parameter which will remove qualifiers from the next development version if set to true. For example, if the release version is 1.0.0-Final then development version will be 1.0.1-SNAPSHOT. The default value is false (i.e. qualifiers will be preserved in next development version).

  • The gitflow:release-finish and gitflow:release goals have developmentVersion parameter which can be used to set the next development version in non-interactive mode.

  • The gitflow:release-finish and gitflow:release goals have versionDigitToIncrement parameter which controls which digit to increment in the next development version. Starts from zero. For example, if the release version is 1.2.3.4 and versionDigitToIncrement is set to 1 then the next development version will be 1.3.0.0-SNAPSHOT. If not set or set to not valid value defaults to increment last digit in the version.

  • The gitflow:release-start and gitflow:release-finish have commitDevelopmentVersionAtStart parameter which controls whether the next development version is set and committed at start or after finish. By default the value is false which means that the next development version is set on the development branch after the release branch has been merged onto the development branch when finishing the release. This has the benefit of being able to easily cancel the release process simply by deleting the release branch. If the value is true then versioning happens on gitflow:release-start. First the project version is set to the release version on the development branch and the release branch is created. Then the development branch is set to the next development version. This allows the development branch to continue immediately with a new version and helps avoid any future merge conflicts related to project versioning. Has effect only when there are separate development and production branches.

  • The gitflow:release-start goal have fromCommit parameter which allows to start the release from the specific commit (SHA).

Remote interaction

At the start of the each goal remote branch(es) will be fetched and compared with the local branch(es). If the local branch doesn’t exist it will be checked out from the remote. Both of these options can be turned off by setting fetchRemote parameter to false.

At the end of the -finish goals development or production and development branches will be pushed to remote. This can be turned off by setting pushRemote parameter to false.

At the end of the -start goals newly created branch (release / feature / hotfix) can be pushed to the remote. This can be achieved by setting pushRemote parameter to true.

The default remote name is origin. It can be customized with custom_origin configuration in pom.xml.

这篇关于GIT -- gitflow的maven插件(gitflow-maven-plugin)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1001552

相关文章

Git中恢复已删除分支的几种方法

《Git中恢复已删除分支的几种方法》:本文主要介绍在Git中恢复已删除分支的几种方法,包括查找提交记录、恢复分支、推送恢复的分支等步骤,文中通过代码介绍的非常详细,需要的朋友可以参考下... 目录1. 恢复本地删除的分支场景方法2. 恢复远程删除的分支场景方法3. 恢复未推送的本地删除分支场景方法4. 恢复

关于Maven生命周期相关命令演示

《关于Maven生命周期相关命令演示》Maven的生命周期分为Clean、Default和Site三个主要阶段,每个阶段包含多个关键步骤,如清理、编译、测试、打包等,通过执行相应的Maven命令,可以... 目录1. Maven 生命周期概述1.1 Clean Lifecycle1.2 Default Li

关于Maven中pom.xml文件配置详解

《关于Maven中pom.xml文件配置详解》pom.xml是Maven项目的核心配置文件,它描述了项目的结构、依赖关系、构建配置等信息,通过合理配置pom.xml,可以提高项目的可维护性和构建效率... 目录1. POM文件的基本结构1.1 项目基本信息2. 项目属性2.1 引用属性3. 项目依赖4. 构

springboot 加载本地jar到maven的实现方法

《springboot加载本地jar到maven的实现方法》如何在SpringBoot项目中加载本地jar到Maven本地仓库,使用Maven的install-file目标来实现,本文结合实例代码给... 在Spring Boothttp://www.chinasem.cn项目中,如果你想要加载一个本地的ja

IDEA常用插件之代码扫描SonarLint详解

《IDEA常用插件之代码扫描SonarLint详解》SonarLint是一款用于代码扫描的插件,可以帮助查找隐藏的bug,下载并安装插件后,右键点击项目并选择“Analyze”、“Analyzewit... 目录SonajavascriptrLint 查找隐藏的bug下载安装插件扫描代码查看结果总结Sona

bat脚本启动git bash窗口,并执行命令方式

《bat脚本启动gitbash窗口,并执行命令方式》本文介绍了如何在Windows服务器上使用cmd启动jar包时出现乱码的问题,并提供了解决方法——使用GitBash窗口启动并设置编码,通过编写s... 目录一、简介二、使用说明2.1 start.BAT脚本2.2 参数说明2.3 效果总结一、简介某些情

每天认识几个maven依赖(ActiveMQ+activemq-jaxb+activesoap+activespace+adarwin)

八、ActiveMQ 1、是什么? ActiveMQ 是一个开源的消息中间件(Message Broker),由 Apache 软件基金会开发和维护。它实现了 Java 消息服务(Java Message Service, JMS)规范,并支持多种消息传递协议,包括 AMQP、MQTT 和 OpenWire 等。 2、有什么用? 可靠性:ActiveMQ 提供了消息持久性和事务支持,确保消

30常用 Maven 命令

Maven 是一个强大的项目管理和构建工具,它广泛用于 Java 项目的依赖管理、构建流程和插件集成。Maven 的命令行工具提供了大量的命令来帮助开发人员管理项目的生命周期、依赖和插件。以下是 常用 Maven 命令的使用场景及其详细解释。 1. mvn clean 使用场景:清理项目的生成目录,通常用于删除项目中自动生成的文件(如 target/ 目录)。共性规律:清理操作

在cscode中通过maven创建java项目

在cscode中创建java项目 可以通过博客完成maven的导入 建立maven项目 使用快捷键 Ctrl + Shift + P 建立一个 Maven 项目 1 Ctrl + Shift + P 打开输入框2 输入 "> java create"3 选择 maven4 选择 No Archetype5 输入 域名6 输入项目名称7 建立一个文件目录存放项目,文件名一般为项目名8 确定

git使用的说明总结

Git使用说明 下载安装(下载地址) macOS: Git - Downloading macOS Windows: Git - Downloading Windows Linux/Unix: Git (git-scm.com) 创建新仓库 本地创建新仓库:创建新文件夹,进入文件夹目录,执行指令 git init ,用以创建新的git 克隆仓库 执行指令用以创建一个本地仓库的