Skip to content

OSGI : unable to resolve dependency for org.antlr.v4.gui #3691

@jherkel

Description

@jherkel

I tried the latest 4.10.1 Java version under OSGI environment. I used version 4.9.3 without any problem. But with version 4.10.1 I could see this exception :
Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=chronos-base; type=karaf.feature; version="[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]"; filter:="(&(osgi.identity=chronos-base)(type=karaf.feature)(version>=0.0.1.SNAPSHOT)(version<=0.0.1.SNAPSHOT))" [caused by: Unable to resolve chronos-base/0.0.1.SNAPSHOT: missing requirement [chronos-base/0.0.1.SNAPSHOT] osgi.identity; osgi.identity=tech.pantheon.chronos.company.api; type=osgi.bundle; version="[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve tech.pantheon.chronos.company.api/0.0.1.SNAPSHOT: missing requirement [tech.pantheon.chronos.company.api/0.0.1.SNAPSHOT] osgi.wiring.package; filter:="(&(osgi.wiring.package=tech.pantheon.chronos.utils.dao)(version>=0.0.0)(!(version>=1.0.0)))" [caused by: Unable to resolve tech.pantheon.chronos.utilities/0.0.1.SNAPSHOT: missing requirement [tech.pantheon.chronos.utilities/0.0.1.SNAPSHOT] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.antlr.v4.runtime)(version>=4.10.0)(!(version>=5.0.0)))" [caused by: Unable to resolve org.antlr.antlr4-runtime/4.10.1: missing requirement [org.antlr.antlr4-runtime/4.10.1] osgi.wiring.package; filter:="(osgi.wiring.package=org.antlr.v4.gui)"]]]]

There is a problem that antlr4-runtime has a MANIFEST.MF with this OSGI import entry:
Import-Package: org.antlr.v4.gui,org.antlr.v4.runtime,org.antlr.v4.runti me.atn,org.antlr.v4.runtime.dfa,org.antlr.v4.runtime.misc,org.antlr.v4. runtime.tree,org.antlr.v4.runtime.tree.pattern,org.antlr.v4.runtime.tre e.xpath

I think that there is an unwanted hard dependency on a package org.antlr.v4.gui and that this dependency should be optional. Something like this:
org.antlr.v4.gui;resolution:=optional

I manually updated MANIFEST.MF and with the change above I was able to use 4.10.1 without any problem

My environment: Java 17, Karaf 4.3.6 (OSGI container)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions