【问题标题】:Handling dependencies of an Eclipse plugin built with Tycho, using a Target Platform使用目标平台处理使用 Tycho 构建的 Eclipse 插件的依赖项
【发布时间】:2015-12-15 15:07:47
【问题描述】:

我正在使用 Tycho 开发一个 Eclipse 插件,并且我想使用目标平台处理我的依赖项,遵循tutorial 中描述的步骤。 但是当我尝试编译我的插件项目(使用全新安装)时,我收到以下错误:

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: com.codeandme.tycho.plugin 1.0.0.qualifier
[ERROR]   Missing requirement: com.codeandme.tycho.plugin 1.0.0.qualifier requires 'bundle org.eclipse.ui 0.0.0' but it could not be found

这是我的插件项目的 pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>com.codeandme.tycho.plugin</artifactId>
    <packaging>eclipse-plugin</packaging>

    <parent>
        <groupId>tycho_example</groupId>
        <artifactId>com.codeandme.tycho.releng</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../com.codeandme.tycho.releng</relativePath>
    </parent>
</project>

这里是父项目的 pom.xml (releng):

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>tycho_example</groupId>
    <artifactId>com.codeandme.tycho.releng</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <properties>
        <tycho.version>0.22.0</tycho.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>



    <build>
        <plugins>
            <plugin>
                <!-- enable tycho build extension -->
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <version>${tycho.version}</version>
                <extensions>true</extensions>
            </plugin>

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <version>${tycho.version}</version>
                <configuration>
                    <resolver>p2</resolver>
                    <pomDependencies>consider</pomDependencies>
                    <target>
                        <artifact>
                            <groupId>tycho_example</groupId>
                            <artifactId>com.codeandme.tycho.releng.targetplatform</artifactId>
                        </artifact>
                    </target>
                    <environments>
                        <environment>
                            <os>win32</os>
                            <ws>win32</ws>
                            <arch>x86</arch>
                        </environment>
                    </environments>
                </configuration>
            </plugin>

        </plugins>
    </build>
    <modules>
        <module>../com.codeandme.tycho.plugin</module>

        <module>../com.codeandme.tycho.releng.targetplatform</module>
    </modules>
</project>  

这是我的目标平台的 pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>com.codeandme.tycho.releng.targetplatform</artifactId>
  <packaging>eclipse-target-definition</packaging>
  <parent>
    <groupId>tycho_example</groupId>
    <artifactId>com.codeandme.tycho.releng</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <relativePath>../com.codeandme.tycho.releng</relativePath>
  </parent>
  <groupId>tycho_example</groupId>
</project>

最后是目标平台的 .tpd:

target "Tycho Tutorial"

with source requirements

location "http://download.eclipse.org/tools/orbit/downloads/drops/R20150519210750/repository/" mars-orbit {
    org.apache.commons.lang3
}

location "http://download.eclipse.org/releases/mars" mars-release {
    org.eclipse.platform.feature.group
    org.eclipse.equinox.executable.feature.group
    org.eclipse.e4.rcp.feature.group
    org.eclipse.ui.trace
    org.eclipse.pde.feature.group
}

我们将不胜感激。

【问题讨论】:

  • org.eclipse.ui 没有出现在您的目标定义中,是吗?
  • 我应该在哪里添加它?

标签: eclipse maven eclipse-plugin tycho target-platform


【解决方案1】:

在您的目标定义中包含org.eclipse.e4.rcp.feature.group,而原始教程要求您包含org.eclipse.rcp.feature.group。这就是缺少 UI 包的原因。

可以很方便的查看目标平台的实际内容:右键.tpd文件,选择“生成目标定义”,打开新生成的.target文件,等待Eclipse解决(观看进度视图),解决后,目标编辑器的“内容”页面会显示该目标平台中可用的插件。

【讨论】:

  • 我用org.eclipse.rcp.feature.group 替换了org.eclipse.e4.rcp.feature.group,但我仍然有同样的错误。我还检查了目标平台的内容,UI包在那里!
猜你喜欢
  • 1970-01-01
  • 2017-05-04
  • 1970-01-01
  • 1970-01-01
  • 2020-09-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-11
相关资源
最近更新 更多