【问题标题】:How to resolve Eclipse plugins from p2-Repository and use them as Maven Dependency如何从 p2-Repository 解析 Eclipse 插件并将它们用作 Maven 依赖项
【发布时间】:2019-01-29 00:11:45
【问题描述】:

是否可以从 p2-repository 解析自己的 eclipse-plugins 并将此插件用作 Maven-Dependency? 我正在编写一个 Maven-Plugin,它也应该使用 Eclipse-Plugins。

<repositories>
    <repository>
        <id>p2-repository</id>
        <name>p2-repository</name>
        <url>https://company.de/artifactory/p2-repo</url>
    </repository>
</repositories>


<dependencies>
    <dependency>
        <groupId>de.own.plugin</groupId>
        <artifactId>de.own.plugin.eclipse</artifactId>
        <version>1.0.0-SNAPSHOT</version>       
    </dependency>
</dependencies>

【问题讨论】:

  • 欢迎来到 Stack Overflow!请带上tour 并通读help center,特别是如何提问。你最好的选择是做你的研究,搜索关于 SO 的相关主题,然后试一试。在进行更多研究和搜索后,发布您的尝试Minimal, Complete, and Verifiable example,并具体说明您遇到的问题,这可以帮助您获得更好的答案。
  • 我不清楚您要做什么,但请注意 Eclipse 插件 jar 仅在安装在 Eclipse 或 Eclipse RCP 中时才会运行。它们不会在普通的 Java 程序中运行
  • 我会使用插件中的一些类和方法。是否有可能将插件解析为 Maven 依赖项?
  • 是否有可以发布插件 JAR 的内部 Maven 存储库? p2 存储库是 Web 服务器还是 e. G。 Nexus 支持 Maven 和 p2?据我所知,没有 Maven 扩展可以将 p2 存储库用作普通 Maven 存储库(在 Tycho 中,您可以指定 p2 存储库,但在非 Tycho Maven 构建中会忽略这些)。
  • 有一个内部的 Mave 存储库,可以在其中发布 jar。我希望有一个 Maven-Plugin 可以帮助从 p2 存储库中解析插件。 p2 存储库是来自 Artfactory 的虚拟存储库。

标签: eclipse-plugin maven-3 p2 target-platform maven-dependency


【解决方案1】:

同时至少有一个解决方案from OpenNTF,这里有一个来自他们的sn-p:

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>p2-resolution.example</artifactId>
<version>0.0.1-SNAPSHOT</version>

<pluginRepositories>
    <!-- the plugin is hosted in OpenNTF's Maven repository -->
    <pluginRepository>
        <id>artifactory.openntf.org</id>
        <name>artifactory.openntf.org</name>
        <url>https://artifactory.openntf.org/openntf</url>
    </pluginRepository>
</pluginRepositories>

<repositories>
    <repository>
        <id>org.eclipse.p2.repo</id>   <!-- defines the groupId to be used below -->
        <url>http://download.eclipse.org/releases/2019-12</url>
        <layout>p2</layout>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.eclipse.p2.repo</groupId>   <!-- matches id of the repo above -->
        <artifactId>ch.qos.logback.slf4j</artifactId>
        <version>1.1.2.v20160301-0943</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.openntf.maven</groupId>
            <artifactId>p2-layout-resolver</artifactId>
            <version>1.2.0</version>
            <extensions>true</extensions>
        </plugin>
    </plugins>
</build>
</project>

【讨论】:

    猜你喜欢
    • 2016-04-15
    • 2018-02-27
    • 2017-03-03
    • 1970-01-01
    • 2015-01-23
    • 2012-11-28
    • 1970-01-01
    • 1970-01-01
    • 2013-04-08
    相关资源
    最近更新 更多