Skip to content

OSGi: Inclusion of Jackson introduces requirement for jersey-server #6071

Description

@aleksi-kangas

I am trying to use Jackson with a shared ObjectMapper configuration on both server and client. In OSGi environment, it seems that inclusion of jersey-media-json-jackson introduces a requirement for jersey-server dependency.

The cause to me seems to be that jersey-media-json-jackson has a dependency to jersey-entity-filtering. The META-INF/MANIFEST.MFin jersey-entity-filtering seems to declare Import-Package to packages exported by the jersey-server bundle.

The maven-bundle-plugin configuration in jersey-entity-filtering/pom.xml:

<configuration>
    <instructions>
        <Export-Package>org.glassfish.jersey.message.filtering.*;version=${project.version}</Export-Package>
        <Import-Package>
            ${jakarta.annotation.osgi.version},
            ${jakarta.rest.osgi.version},
            *
        </Import-Package>
    </instructions>
    <unpackBundle>true</unpackBundle>
</configuration>

and dependencies of jersey-entity-filtering:

    <dependencies>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-server</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.test-framework</groupId>
            <artifactId>jersey-test-framework-core</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

My understanding is that the *-import resolves also server (+ client?) packages. Is this intended?

Dependencies used:

<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-client</artifactId>
    <version>4.0.2</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-server</artifactId>
    <version>4.0.2</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-json-jackson</artifactId>
    <version>4.0.2</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.ext</groupId>
    <artifactId>jersey-entity-filtering</artifactId>
    <version>4.0.2</version>
</dependency>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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