Unable to use Maven dependency in Eclipse RCP application when using Target Platform

Viewed 190

I have a large Eclipse RCP application with lots of transitive dependencies.

Currently, these are manually copied into the classpath but that's a significant administrative overhead I'd like to avoid, and would instead like to use Maven, as discussed here.

I've created a simple RCP application.

I've created a target-platform.target, which imports the RCP dependencies and my Maven dependency:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target includeMode="feature" name="Running Platform">
    <locations>
        <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
            <repository location="http://download.eclipse.org/releases/2021-03" />
            <unit id="org.eclipse.sdk.feature.group" version="0.0.0" />
            <unit id="org.eclipse.emf.edit.feature.group" version="0.0.0" />
            <unit id="org.eclipse.equinox.p2.core.feature.feature.group" version="0.0.0" />
            <unit id="org.eclipse.gef.sdk.feature.group" version="0.0.0" />
        </location>
        <location includeDependencyDepth="infinite" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
            <dependencies>
                <dependency>
                    <groupId>com.github.oshi</groupId>
                    <artifactId>osh-core</artifactId>
                    <version>5.4.0</version>
                    <type>jar</type>
                </dependency>
            </dependencies>
        </location>
    </locations>
</target>

I've set this as the Active Target Platform, but when I attempt to access the contents of this dependency in my application (e.g. by using new oshi.SystemInfo.SystemInfo()), it can't be resolved.

I thought I needed to add it as a plugin in the manifest.mf, which worked for other Maven dependencies I tried, but not this one - it doesn't show up in the GUI list of plugins to add.

And if I add a Require-Bundle entry for it manually:

wrapped.com.github.oshi.oshi-core;bundle-version="5.4.0"

I get:

Bundle 'wrapped.com.github.oshi.oshi-core' cannot be resolved

And get a similar if I try:

com.github.oshi.oshi-core;bundle-version="5.4.0"

I have a similar scenario with a different library.

target-platform.target:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target includeMode="feature" name="Running Platform">
    <locations>
        <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
            <repository location="http://download.eclipse.org/releases/2021-03" />
            <unit id="org.eclipse.sdk.feature.group" version="0.0.0" />
            <unit id="org.eclipse.emf.edit.feature.group" version="0.0.0" />
            <unit id="org.eclipse.equinox.p2.core.feature.feature.group" version="0.0.0" />
            <unit id="org.eclipse.gef.sdk.feature.group" version="0.0.0" />
        </location>
        <location includeDependencyDepth="infinite" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
            <dependencies>
                <dependency>
                    <groupId>com.github.xni06</groupId>
                    <artifactId>JCoord</artifactId>
                    <version>24347197e2364650a6b1cf2cc46d064414edc22a</version>
                    <type>jar</type>
                </dependency>
            </dependencies>
            <repositories>
                <repository>
                    <id>jitpack.io</id>
                    <url>https://jitpack.io</url>
                </repository>
            </repositories>
        </location>
    </locations>
</target>

If I add a Require-Bundle entry for it manually:

wrapped.com.github.xni06.JCoord;bundle-version="24347197e2364650a6b1cf2cc46d064414edc22a"

I get:

invalid range "24347197e2364650a6b1cf2cc46d064414edc22a": invalid version "24347197e2364650a6b1cf2cc46d064414edc22a": non-numeric "24347197e2364650a6b1cf2cc46d064414edc22a"

And when I try:

wrapped.com.github.xni06.JCoord;bundle-version="0.0.0"

I get:

invalid range "24347197e2364650a6b1cf2cc46d064414edc22a": invalid version "24347197e2364650a6b1cf2cc46d064414edc22a": non-numeric "24347197e2364650a6b1cf2cc46d064414edc22a"

How can I get these dependencies imported?

0 Answers
Related