如何为Maven Release插件默认scmDevelopmentCommitComment添加[ci skip]
Maven Release插件追加
[ci skip]到默认提交消息的实现方法 首先明确:Maven Release插件没有提供直接引用默认提交消息的内置变量(比如你设想的@{defaultScmDevelopmentCommitComment}不存在),不过可以通过以下两种方式实现需求:
方式一:直接复写默认消息并追加标记
Maven Release插件默认的scmDevelopmentCommitComment内容是@{prefix} prepare for next development iteration,你只需要把这个默认内容写出来,再加上[ci skip]即可:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>你的插件版本</version> <configuration> <scmDevelopmentCommitComment>@{prefix} prepare for next development iteration [ci skip]</scmDevelopmentCommitComment> </configuration> </plugin>
其中@{prefix}是插件自带的变量,会自动替换你配置的发布前缀(如果没特意设置releasePrefix,则为空)。
方式二:用自定义属性维护默认消息(更灵活)
如果担心后续插件更新导致默认消息变化,或者想统一管理提交消息模板,可以在pom的属性中定义默认内容,再引用并追加标记:
- 先在
<properties>里添加自定义属性:
<properties> <default.development.commit.msg>@{prefix} prepare for next development iteration</default.development.commit.msg> </properties>
- 然后在插件配置中引用该属性:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <version>你的插件版本</version> <configuration> <scmDevelopmentCommitComment>${default.development.commit.msg} [ci skip]</scmDevelopmentCommitComment> </configuration> </plugin>
这样后续要修改默认消息模板时,只需要更新<properties>里的内容即可。
内容的提问来源于stack exchange,提问作者BuZZ-dEE
相关产品推荐
相关产品推荐

