有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Eclipse插件的java跨项目版本控制

我有多个相互依赖的Elipse插件项目。与此有关的几个问题:

1)如果我更改了一个插件的版本号,是否有可能自动更新插件。依赖插件的xml文件以反映版本号更改

2)Maven pom也一样:当我更改版本号时,我是否可以自动更新pom

3)如果我想保留插件。xml和pom。xml版本号一致,是否有一种自动方法

4)最后一点:如果我有多个项目应该具有相同的版本号,我可以以某种方式同步版本号吗


共 (2) 个答案

  1. # 1 楼答案

    正如khmarbaise所指出的,还有Tycho,它是一个maven插件,充当maven和eclipse插件之间的桥梁

    这两个链接提供了实现我在问题中提出的要求所需的信息:

    https://docs.sonatype.org/display/M2ECLIPSE/Staging+and+releasing+new+M2Eclipse+release

    http://software.2206966.n2.nabble.com/Incrementing-updating-release-version-of-plugins-while-generating-p2-site-td5929658.html

    看起来你需要使用这个命令

    mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=<version>
    

    它应该设置父pom、模块和插件的所有版本。将xml转换为给定版本。喜欢

  2. # 2 楼答案

    使用Maven Release Plugin-尤其是^{} goal-至少可以解决您已经解决的一些问题

    http://maven.apache.org/的文件中:

    In some situations you may want an easy way to update the version numbers in each POM of a multi-module project. The update-versions goal is designed to accomplish this.

    To update the version numbers in your POMs, run:

    mvn release:update-versions

    You will be prompted for the version number for each module of the project. If you prefer that each module version be the same as the parent POM, you can use the option autoVersionSubmodules.

    mvn release:update-versions -DautoVersionSubmodules=true

    In this case you will only be prompted for the desired version number once.