简体   繁体   English

在 maven 发布插件中添加后缀

[英]Add suffix in maven release plugin

I would like to add a TEST suffix when building with the Maven release plugin.我想在使用 Maven 发布插件构建时添加一个TEST后缀。 The idea that if the user which builds the artifact ticks a checkbox, then a TEST version is build.如果构建工件的用户勾选复选框,则构建TEST版本的想法。

So the POM contains a version like 1.2.3-SNAPSHOT and I would like to build 1.2.3-TEST .所以 POM 包含一个类似1.2.3-SNAPSHOT的版本,我想构建1.2.3-TEST The Maven release plugin allows you to set the target version, but I do not know how I should reference the original version (or parts thereof) for the new version, like Maven 发布插件允许您设置目标版本,但我不知道我应该如何引用新版本的原始版本(或其部分),例如

${oldVersionWithoutSnapshot}-TEST$ . ${oldVersionWithoutSnapshot}-TEST$

Any ideas how to implement this?任何想法如何实现这一点?

I would try the Build Helper Maven Plugin .我会尝试Build Helper Maven Plugin

The parse-version goal parses the version to get the component parts, and regex-property does replacements. parse-version目标解析版本以获取组成部分, regex-property替换。

I've also used the GMaven plugin before to set properties, but not for as specific a use case as yours.我之前也使用过GMaven插件来设置属性,但不像你的用例那样具体。 This answer gives the idea.这个答案给出了想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM