Karaf / Maven – Unable to resolve: missing requirement osgi.wiring.package

I believe you have two options here.

If you have Import-Package: com.google.gson;version="[2.3,3)" in your MANIFEST.MF, this means that you want some package to be imported from a deployed bundle, not from an embedded jar. In this case, you should first deploy gson-2.3.1.jar bundle (copy this file to the deploy folder), and then deploy your bundle.

If you want to embed the gson library as a simple non-OSGi jar dependency, this also can be done, but then you have to exclude its packages from Import-Package:

    <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
            <instructions>
                <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                <Import-Package>!com.google.gson,*</Import-Package>
                <Embed-Dependency>gson</Embed-Dependency>
            </instructions>
        </configuration>
    </plugin>

Leave a Comment