java自定义maven插件,如何自定义Maven发布插件的标签格式?

In our SVN repo, we store tags like this:

trunk

project_a

project_b

branches

project_a

branch_x

branch_y

project_b

tags

project_a

1.0

1.1

project_b

1.0

When I run the Maven release plugin's "prepare" goal on project A, by default it creates the tag as "tags/project_a-x.x", which does not match my tag naming scheme above. I am thus depending upon whoever does the release (i.e. a fallible human) to spot this and change the tag to "tags/project_a/x.x". How can I tell the release plugin to use the correct format by default?

The "prepare" goal has a "tag" configuration option that claims to do this, but if I set it as follows:

org.apache.maven.plugins

maven-release-plugin

2.1

${project.artifactId}/${project.version}

... then the created tag is "tags/project_a/x.x-SNAPSHOT", i.e. it uses the pre-release version number instead of the release version number. Hardcoding the tag name into the POM seems wrong too.

How can I ensure that the tag is correct by default?

解决方案

The release plugin now supports the tagNameFormat configuration option, which defaults to @{project.artifactId}-@{project.version}. In your case, you could do something like:

org.apache.maven.plugins

maven-release-plugin

2.3.2

@{project.artifactId}/@{project.version}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值