使用第谷针对两个 Eclipse 版本测试我的代码



我需要针对两个目标平台测试我的代码(一开始可能是错误的,但我想把重点放在这个问题上(:开普勒和卢娜。

为此,我在父项目中定义了两个存储库:

<repositories>
    <repository>
        <id>kepler</id>
        <layout>p2</layout>
        <url>http://download.eclipse.org/releases/kepler</url>
    </repository>
    <repository>
        <id>luna</id>
        <layout>p2</layout>
        <url>http://download.eclipse.org/releases/luna</url>
    </repository>
</repositories>

然后我创建了两个插件,一个用于开普勒,一个用于 Luna,它们声明了两个不同的依赖项(代码是重复的,但这也是一个单独的问题(:

 // Luna
 Require-Bundle:
 org.eclipse.e4.core.contexts;bundle-version="1.3.100"
 // Kepler
 Require-Bundle:
 org.eclipse.e4.core.contexts;bundle-version="[1.3.0,1.3.100)"

现在,当我通过-D或设置.xml指定足够的tycho.target-platform并使用mvn clean install运行构建时,其中一个插件总是失败,另一个插件成功。如果我不指定月神目标,Luna 就会失败,如果我不指定开普勒目标,开普勒就会失败。

一定有更好的方法,我告诉自己,我读到target-platform-configuration我已经配置了所有可能的 os/ws/arch 组合。但它仍然失败了。我做错了什么?

问题是通过使用已弃用的 -Dtycho.target-platform 属性覆盖 POM 中的目标平台配置。设置该属性后,Tycho 将不再使用您指定的两个 p2 存储库中的工件。

因此,不要使用此属性(并确保不要将其设置为您的设置.xml(,并且您的方法应该有效。

我的答案是在检查我的 ~/.m2/settings.xml 后立即得出的:

<profile>
  <id>tycho-kepler</id>
  <activation>
    <activeByDefault>true</activeByDefault>
  </activation>
  <properties>
    <tycho.targetPlatform>/usr/local/share/eclipse</tycho.targetPlatform>
  </properties>
</profile>
<profile>
  <id>tycho-luna</id>
  <activation>
    <activeByDefault>false</activeByDefault>
  </activation>
  <properties>
    <tycho.targetPlatform>/usr/local/share/eclipse-luna</tycho.targetPlatform>
  </properties>
</profile>

显然,即使没有在构建中指定-P或配置文件,这些行也会添加到执行中,而我现在没有这样做。删除它们立即解决了问题。

相关内容

最新更新