如何使用maven/tycho构建自动插入RCP应用程序编号?

发布于 2025-02-10 04:40:27 字数 363 浏览 2 评论 0 原文

我已经使用Maven/Tycho完成了Eclipse RCP应用程序的构建自动化。 现在,我想让它更加无缝。因此,我正在检查我们是否可以在每个构建中自动使用应用程序版本。 例如,如您在附件图片中所看到的。 在此处输入图像描述 版本为1.2.0。因此,在每个构建中,它都应增加版本1.2.1、1.2.2、1.2.3之类的版本,而不必在产品文件中手动更改版本。执行父pom(触发构建)后,它也应增加应用程序版本并完成 构建过程,全部是MVN安装的一个命令。 我们可以使用maven/pom.xml做到这一点,还是请建议其他解决方案?

I have completed build automation of Eclipse RCP application using maven/tycho.
Now I want to make it more seamless. So I am checking if we can auto-increment application version with every build.
for e.g. As you can see in attached picture, snapshot of .product file. enter image description here
Version is 1.2.0. So with every build, it should increase the version number 1.2.1, 1.2.2, 1.2.3, and so on, without changing the version manually in product file. Once I execute the parent pom(trigger the build), it should also increment app version and complete
the build process, all in one command that is mvn install.
can we achieve this using maven/POM.xml or please suggest any other solution??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

稚气少女 2025-02-17 04:40:27

您可以使用 org.codehaus.mojo的目标 parse-version :build-helper-maven-plugin (在此处记录: https://www.mojohaus.org/build-helper-helper-helper-helper-helper-helper-helper-maven-plugin/parse-parse-parse-parse-version -mojo.html )。这将将当前版本的部分存储在某些属性中(默认情况下, parsedversion.majorversion parsedversion.minorversion and code> parsedversion.incrementalversion )。您可以使用此类信息来计算合适的下一个版本号。

然后,由于您使用的是tycho,因此您可以适当地将这些属性传递到 org.eclipse.tycho的目标 set-version :tycho-versions-plugin )。

在这里,您可以看到一个简化的示例,使用这两个目标删除 -Snapshot .qualifier https://www.lorenzobettini.it.it/2020/02/remove-snapshot-snapshot-and-qualifier-in -maven-tycho-builds/

就像我说的那样,在您的情况下,您必须进行更多操作来计算下一个版本号。

You can use the goal parse-version of the org.codehaus.mojo:build-helper-maven-plugin (documented here: https://www.mojohaus.org/build-helper-maven-plugin/parse-version-mojo.html). This will store the parts of the current version in some properties (by default, parsedVersion.majorVersion, parsedVersion.minorVersion and parsedVersion.incrementalVersion). You can use such information to compute the next version number as you see fit.

Then, since you are using Tycho, you can pass these properties appropriately to the goal set-version of the org.eclipse.tycho:tycho-versions-plugin (https://tycho.eclipseprojects.io/doc/latest/tycho-release/tycho-versions-plugin/plugin-info.html).

Here you can see a simplified example using these two goals to remove the -SNAPSHOT and .qualifier: https://www.lorenzobettini.it/2020/02/remove-snapshot-and-qualifier-in-maven-tycho-builds/.

As I said, in your case, you'll have to do a few more operations to compute the next version number.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文