如何为使用 Maven 构建的 Eclipse 插件自动化版本号更新过程 [英] How to automate version number update process for my Eclipse plugin built with Maven

查看:33
本文介绍了如何为使用 Maven 构建的 Eclipse 插件自动化版本号更新过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个类似于 这里描述的项目的项目.所以,它在父 pom.xml 中有几个模块:

I working with a project similar to the project described here. So, it has a few modules in parent pom.xml:

 <modules>
    <module>../de.vogella.tycho.plugin</module>
    <module>../de.vogella.tycho.feature</module>
    <module>../de.vogella.tycho.p2updatesite</module>
 </modules>

这些模块有一个通用的版本号,例如1.0.0-SNAPSHOT 或不带 -SNAPSHOT.feature.xml 文件需要包含相同的版本号:

These modules have a general version number e.g. 1.0.0-SNAPSHOT or without -SNAPSHOT. The feature.xml file needs to contain the same version number:

<feature
      id="com.my.feature"
      label="My plugin feature"
      version="1.0.0">

和:

<plugin
      id="com.my.plugin"
      download-size="0"
      install-size="0"
      version="1.0.0"
      unpack="false"/>

文件 category.xml(在 p2 更新站点项目中)和 MANIFEST.MF(在插件项目中)需要包含相同的值.

The files category.xml (in p2 update-site projects) and MANIFEST.MF (in plugin projects) need to contain the same value.

问题是:如何使用 Maven 自动化所有这些文件中的版本号更新过程?

The question is: How to automate the version number update process in all these files using Maven?

我尝试使用 maven-release-plugin 和 maven-versions-plugin 解决此问题.第一个插件做了很多未使用的操作(比如做很多 CVS 提交,我在这个项目中没有使用).第二个插件只修改pom.xml文件,不修改feature.xml、category.xml和MANIFEST.MF,还是我用的不太好.

I tried to resolve this problem using maven-release-plugin and maven-versions-plugin. The first plugin makes a lot of unused actions (like making a lot of CVS commits, which I do not use in this project). The second plugin only makes changes in pom.xml files and do not modify feature.xml, category.xml and MANIFEST.MF, or I used it not so good.

推荐答案

有一个特殊的tycho-versions-plugin 正是针对这个问题.它(故意)与 maven-versions-plugin 相同,但也会更新 feature.xml 和 MANIFEST.MF 中的(冗余)版本.

There is a special tycho-versions-plugin for exactly this problem. It (intentionally) does the same as the maven-versions-plugin, but also updates the (redundant) versions in feature.xml and MANIFEST.MF.

更重要的是,该插件还更新了指定确切版本的引用,例如对 feature.xml 中插件的引用,或对 category.xml 中的功能的引用.所以最后,所有出现的工件版本都会更新,就像在重构中一样.

Even more, the plugin also updates references which specify an exact version, like references to plug-ins in a feature.xml, or references to features in a category.xml. So in the end, all occurrences of the artifact versions are updated, like in a refactoring.

对于具有确切版本的参考,在正常的 Tycho 构建期间还会自动更新.所以如果例如您的功能在 1.0.0.qualifier 版本中引用了您的插件,此版本字符串将使用限定符的实际值进行更新,例如1.0.0.201207171147.您可以利用此功能来最小化 tycho-versions-plugin 需要更新的地方的数量:您可以使用魔术版本 0.0.0<而不是在参考中指定当前版本文字/代码>.作为正常构建的一部分,此版本也会自动更新到最新版本.

For references with exact versions, there is also an automatic update during the normal Tycho build. So if e.g. your feature references your plug-in in version 1.0.0.qualifier, this version string is updated with the actual value of the qualifier, e.g. 1.0.0.201207171147. You can make use of this functionality to minimize the number of places that need to be updated by the tycho-versions-plugin: Instead of specifying the current version literal in the reference, you can use the magic version 0.0.0. This version is also automatically updated to the latest version as part of the normal build.

这篇关于如何为使用 Maven 构建的 Eclipse 插件自动化版本号更新过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆