0

Is it possible to resolve own eclipse-plugins from an p2-repository and to use this plugins as Maven-Dependency? I am writing a Maven-Plugin which should also use the 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>
Striezel
  • 3,693
  • 7
  • 23
  • 37
GreenJenks
  • 111
  • 1
  • 9
  • 4
    Welcome to Stack Overflow! Please take the [tour](https://stackoverflow.com/tour) and read through the [help center](http://stackoverflow.com/help), in particular how to ask. Your best bet here is to do your research, search for related topics on SO, and give it a go. After doing more research and searching, post a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) of your attempt and say specifically where you're stuck, which can help you get better answers. – help-info.de Aug 22 '18 at 17:02
  • I'm not clear what you are trying to do but note that Eclipse plugin jars will only run when installed in Eclipse or an Eclipse RCP. They won't run in a plain Java program – greg-449 Aug 23 '18 at 07:54
  • I would use some Classes and Methods from the plugins. Is it anyway possible to resolve the plugins as Maven dependency? – GreenJenks Aug 23 '18 at 08:28
  • Is there an in-house Maven repository where the plugin JAR could be published? Is the p2 repository a web server or e. g. Nexus which supports both Maven and p2? As far as I know, there is no Maven extension to use a p2 repository as a normal Maven repository (in Tycho you can specify p2 repositories but these are ignored in a non-Tycho Maven build). – howlger Aug 23 '18 at 08:39
  • There is an in-house Mave repository where the jars could be published. I was hoping there is an Maven-Plugin which helps to resolve Plugins from an p2-repository. The p2 Repository is a virtual repo from Artfactory. – GreenJenks Aug 26 '18 at 21:54
  • From my experience you can use [Eclipse Tycho|https://www.eclipse.org/tycho/] as a Maven-Plugin to access, resolve and build OSGi-Bundles via Maven. If this still is important to you, let me know and I'll write up a little more in this regard as an answer. – Igor Sep 09 '19 at 16:41

1 Answers1

0

Meanwhile there's at least one solution from OpenNTF, here's a snippet from them:

<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>
Rots
  • 728
  • 9
  • 20