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

查看:482
本文介绍了如何使用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中插件的引用,或对categories.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.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天全站免登陆