gpt4 book ai didi

java - 如何使用本地p2站点解决RCP应用程序开发中的依赖问题?

转载 作者:行者123 更新时间:2023-11-30 07:08:37 26 4
gpt4 key购买 nike

我是 RCP 开发的新手。这是我的问题。

  1. 首先,下面的截图是我的目录结构。 enter image description here

  2. 我想使用Unirest for Java在我的插件项目中,在我们的例子中是 com.example.e4.rcp.todo

  3. 我关注this mvn jetty:run 在本地运行 p2 更新站点成功了,我将以下行添加到 <artifacts>

    <artifact><id>com.mashape.unirest:unirest-java:1.4.9</id></artifact>
  4. 现在我想使用 Maven 通过 Tycho 来构建我的项目。这是我的 pom.xml,位于 com.example.e4.rcp.todo 目录下。

    <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>com.example.e4.rcp</groupId>
    <artifactId>com.example.e4.rcp.todo</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>eclipse-plugin</packaging>

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

    <build>
    <plugins>
    <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-maven-plugin</artifactId>
    <version>0.26.0</version>
    <extensions>true</extensions>
    </plugin>
    <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-p2-repository-plugin</artifactId>
    <version>0.26.0</version>
    </plugin>
    <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>target-platform-configuration</artifactId>
    <version>0.26.0</version>
    <configuration>
    <environments>
    <environment>
    <os>linux</os>
    <ws>gtk</ws>
    <arch>x86</arch>
    </environment>
    <!-- and others... -->
    </environments>
    </configuration>
    </plugin>
    </plugins>
    </build>
    </project>
  5. 当我运行时mvn clean package ,它显示以下错误:

[ERROR] Cannot resolve project dependencies: [ERROR] Software being installed: com.example.e4.rcp.todo 1.0.0.qualifier [ERROR] Missing requirement: com.example.e4.rcp.todo 1.0.0.qualifier requires 'bundle com.mashape.unirest.java 1.4.9' but it could not be found [ERROR] [ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help. [ERROR] Cannot resolve dependencies of MavenProject: com.example.e4.rcp:com.example.e4.rcp.todo:1.0.0-SNAPSHOT @ C:\Users\wangzen\workspace2\com.example.e4.rcp.todo\pom.xml: See log for details -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException

我应该怎么做才能解决这个问题?我是否必须将本地 p2 更新站点添加到 pom.xml 中?

顺便说一句:如果有人可以帮助我格式化我的问题描述,特别是在 pom.xml 部分,我将非常感激。我尝试过使用 <code>阻止,但似乎不起作用。

最佳答案

您需要添加

<repository>
<id>unirest</id>
<url>file:/path/to/unirest/p2/repo</url> <!-- or an http:// based one if available -->
<layout>p2</layout>
</repository>

关于java - 如何使用本地p2站点解决RCP应用程序开发中的依赖问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39606703/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com