1

I want to use logback.slf4j in my Eclipse plugin, so I added it as a requirement to my MANIFEST.MF file:

Require-Bundle: org.eclipse.equinox.app,
 org.eclipse.equinox.launcher,
 ...,
 ch.qos.logback.slf4j;bundle-version="1.0.7"

Then I start the build with additional debug (mvn clean package -X) and in the output I can see that logback.slf4j is properly downloaded along with its dependencies:

[INFO] Fetching 201705151400&countryCode=us&timeZone=1&format=xml from http://www.eclipse.org/downloads/download.php?format=xml&file=/releases/neon/
[INFO] Fetching ch.qos.logback.classic_1.0.7.v20121108-1250.jar.pack.gz from http://download.eclipse.org/releases/neon/201705151400/plugins/ (79,74kB)
[INFO] Fetching ch.qos.logback.classic_1.0.7.v20121108-1250.jar.pack.gz from http://download.eclipse.org/releases/neon/201705151400/plugins/ (79,74kB)
[INFO] Fetching ch.qos.logback.core_1.0.7.v20121108-1250.jar.pack.gz from http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/releases/neon/201705151400/plugins/ (112,71kB)
[INFO] Fetching ch.qos.logback.core_1.0.7.v20121108-1250.jar.pack.gz from http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/releases/neon/201705151400/plugins/ (112,71kB)
[INFO] Fetching org.slf4j.api_1.7.2.v20121108-1250.jar.pack.gz from http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/releases/neon/201705151400/plugins/ (16,96kB)
[INFO] Fetching org.slf4j.api_1.7.2.v20121108-1250.jar.pack.gz from http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/releases/neon/201705151400/plugins/ (16,96kB)
[INFO] Fetching ch.qos.logback.slf4j_1.0.7.v201505121915.jar.pack.gz from http://mirror.tspu.ru/eclipse/releases/neon/201705151400/plugins/ (7,59kB)
[INFO] Fetching ch.qos.logback.slf4j_1.0.7.v201505121915.jar.pack.gz from http://mirror.tspu.ru/eclipse/releases/neon/201705151400/plugins/ (7,59kB)
[INFO] Resolving class path of MavenProject: com.example.myplugin:com.example.myplugin:0.0.1 @ ~\Desktop\tycho_example\bundles\com.example.myplugin\.polyglot.build.properties

Then Tycho prints the list of resolved bundles, which also confirms that the newly downloaded plugins are properly resolved:

[DEBUG] Equinox resolver state:
Resolved OSGi state
RESOLVED org.eclipse.osgi_3.11.3.v20170209-1843 : ~\.m2\repository\p2\osgi\bundle\org.eclipse.osgi\3.11.3.v20170209-1843\org.eclipse.osgi-3.11.3.v20170209-1843.jar
RESOLVED ch.qos.logback.classic_1.0.7.v20121108-1250 : ~\.m2\repository\p2\osgi\bundle\ch.qos.logback.classic\1.0.7.v20121108-1250\ch.qos.logback.classic-1.0.7.v20121108-1250.jar
RESOLVED ch.qos.logback.core_1.0.7.v20121108-1250 : ~\.m2\repository\p2\osgi\bundle\ch.qos.logback.core\1.0.7.v20121108-1250\ch.qos.logback.core-1.0.7.v20121108-1250.jar
RESOLVED org.slf4j.api_1.7.2.v20121108-1250 : ~\.m2\repository\p2\osgi\bundle\org.slf4j.api\1.7.2.v20121108-1250\org.slf4j.api-1.7.2.v20121108-1250.jar
RESOLVED ch.qos.logback.slf4j_1.0.7.v201505121915 : ~\.m2\repository\p2\osgi\bundle\ch.qos.logback.slf4j\1.0.7.v201505121915\ch.qos.logback.slf4j-1.0.7.v201505121915.jar
RESOLVED org.eclipse.equinox.app_1.3.400.v20150715-1528 : ~\.m2\repository\p2\osgi\bundle\org.eclipse.equinox.app\1.3.400.v20150715-1528\org.eclipse.equinox.app-1.3.400.v20150715-1528.jar
...

However, in the end I get the following:

NOT RESOLVED com.example.myplugin_0.0.1 : ~\Desktop\tycho_example\bundles\com.example.myplugin
        Missing Constraint: Require-Bundle: ch.qos.logback.slf4j; bundle-version="1.0.7"

[ERROR] Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle com.example.myplugin cannot be resolved
[ERROR] Resolution errors:
[ERROR]    Bundle com.example.myplugin - Missing Constraint: Require-Bundle: ch.qos.logback.slf4j; bundle-version="1.0.7"
[ERROR] -> [Help 1]

Has anyone seen similar issue?

yashu
  • 35
  • 3
  • is ch.qos.logback.slf4j a OSGi bundle? I'm not sure about... – khmarbaise Oct 25 '17 at 10:43
  • According to the log I included above it's downloaded from the eclipse p2 repository, so I guess it is [link](http://download.eclipse.org/releases/neon/201705151400/plugins/ch.qos.logback.slf4j_1.0.7.v201505121915.jar) – yashu Oct 26 '17 at 11:52
  • see answer in https://stackoverflow.com/a/13494980/301049 – Rots Jun 30 '20 at 14:39

1 Answers1

0

As described in https://stackoverflow.com/a/45190630/301049

I managed to add a dependency on a fragment for a test plugin explicitly in pom.xml with the following target-platform-configuration plugin configuration:

<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>target-platform-configuration</artifactId>
    <configuration>
        <dependency-resolution>
            <extraRequirements>
                <requirement>
                    <type>eclipse-plugin</type>
                    <id>org.acme.module.fragment</id>
                    <versionRange>0.0.0</versionRange>
                </requirement>
            </extraRequirements>
        </dependency-resolution>
    </configuration>
</plugin>
Rots
  • 728
  • 9
  • 20