java - 从 Tycho P2 存储库切换到 Eclipse Target 文件

标签 java maven eclipse-rcp tycho

我想将基于 Eclipse Luna 的 Eclipse RCP 项目从“POM 中的 P2 存储库”方法切换到目标文件方法。 (从Tycho Documentation中的方法2到方法1)。 这看起来很简单,但这并不是因为我需要支持多个环境。

所以在我的旧父 pom 中我有:

<repositories>
    <repository>
        <id>eclipse platform</id>
        <url>https://my-domain/nexus/repository/eclipse_luna_repo/</url>
        <layout>p2</layout>
    </repository>
    <repository>
        <id>e4 tools</id>
        <url>https://my-domain/nexus/repository/e4_tools/</url>
        <layout>p2</layout>
    </repository>
</repositories>

还有:

<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>target-platform-configuration</artifactId>
    <version>${tycho.version}</version>
    <configuration>
        <resolver>p2</resolver>
        <environments>
            <environment>
                <os>win32</os>
                <ws>win32</ws>
                <arch>x86</arch>
            </environment>
            <environment>
                <os>win32</os>
                <ws>win32</ws>
                <arch>x86_64</arch>
            </environment>
            <environment>
                <os>linux</os>
                <ws>gtk</ws>
                <arch>x86_64</arch>
            </environment>
        </environments>
    </configuration>
</plugin>

这足以定义目标平台,因为第谷然后会选择从不同插件定义中定义的所需依赖项。

如何获得等效的目标文件?

到目前为止我的尝试如下(用 Target Platform DSL 转换):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="My Target" sequenceNumber="1621516437">
  <locations>
    <location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
      <unit id="org.eclipse.platform.feature.group" version="4.4.2.v20150204-1700"/>
      <unit id="org.eclipse.rcp.feature.group" version="4.4.2.v20150204-1700"/>
      <unit id="org.eclipse.jdt.feature.group" version="3.10.1.v20150204-1700"/>
      <unit id="org.eclipse.equinox.p2.discovery.feature.feature.group" version="1.0.200.v20140512-1802"/>
      <unit id="org.eclipse.equinox.executable.feature.group" version="3.6.102.v20150204-1316"/>
      <unit id="org.eclipse.ui" version="3.106.1.v20141002-1150"/>
      <unit id="org.eclipse.core.filesystem.linux.x86_64" version="1.2.200.v20140124-1940"/>
      <unit id="org.eclipse.core.filesystem.win32.x86" version="1.4.0.v20140124-1940"/>
      <unit id="org.eclipse.core.net.linux.x86_64" version="1.1.100.v20140124-2013"/>
      <unit id="org.eclipse.core.net.win32.x86" version="1.0.100.v20140124-2013"/>
      <unit id="org.eclipse.equinox.security.win32.x86" version="1.0.300.v20130327-1442"/>
      <unit id="org.eclipse.swt.gtk.linux.x86_64" version="3.103.2.v20150203-1351"/>
      <unit id="org.eclipse.swt.win32.win32.x86" version="3.103.2.v20150203-1351"/>
      <repository id="eclipse-luna" location="https://my-domain/nexus/repository/eclipse_luna_repo"/>
    </location>
    <location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
      <unit id="org.eclipse.e4.tools.compat" version="0.12.0.v20141113-1753"/>
      <unit id="org.eclipse.e4.tools.services" version="0.12.0.v20141120-0900"/>
      <repository id="e4_luna_tools" location="https://my-domain/nexus/repository/e4_tools"/>
    </location>
  </locations>
</target>

但是当我使用 Tycho 构建时,出现以下异常:

org.eclipse.core.filesystem.linux.x86_64 1.2.200.v20140124-1940 无法在此环境中安装,因为其过滤器不适用。

我认为有两种解决方案:

  • 为每个环境使用目标文件
    • 但这似乎需要大量工作,我必须为每个环境完全构建
    • 至少中间步骤有效。仅限于 win32 win32 x86_64 Eclipse 可以启动我的程序,第谷可以构建它。
  • 将 P2 存储库中的每个插件放入目标文件中,并使用 includeMode="slicer"includeAllPlatforms="true"
    • 这似乎不起作用,因为某些 PowerPC 依赖项无法解析。我没有使用 PowerPC 架构。

此外,这可能是这个问题的重复:Feature For Multiple OS 但由于它已经四年了并且没有答案,我想我会再试一次......

最佳答案

而不是依赖于平台的安装单元,如 org.eclipse.core.filesystem.linux.x86_64 , org.eclipse.core.filesystem.win32.x86等。您应该添加包含平台相关单元作为子级的安装单元(具有特定于平台的过滤器)。

为您的第一个<location> ,使用以下三个单位代替您拥有的所有单位(至少 that's what works for me ):

<unit id="org.eclipse.equinox.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.sdk.ide" version="0.0.0"/>
<unit id="org.eclipse.jdt.feature.group" version="0.0.0"/>

关于java - 从 Tycho P2 存储库切换到 Eclipse Target 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67619806/

相关文章:

java - Jenkins:doFill 函数没有正确获取@QueryParameter

java - 尝试使用 play.libs.OAuth 连接到 Twitter 时出现错误 401

java - Android 中的复杂 JSON 解析 - 多对象和数组

jsf - Tomcat 7.0.37 JSF 应用程序部署 ClassNotFound FacesServlet

eclipse - 包 org.junit 不存在 Junit 5

java - 如何在 eclipse-rcp 应用程序中使用 org.apache.logging.log4j.jul.LogManager?

java - XMLMultiPageEditor部分文档

java - 实际参数列表和正式参数列表的长度不同?

java - 升级到cxf-rt-frontend-jaxrs-3.1.13后,WadlGenerator无法转换为javax.ws.rs.container.ContainerRequestFilter

java - 如果想在 RCP 应用程序开发中添加本地 p2 更新站点,如何使用 Tycho 在 pom.xml 的 <repository> 部分中指定 <id> 和 <url>?