这是indexloc提供的服务,不要输入任何密码
Skip to content

Change jackson-module-jaxb-annotations dependency to optional in pom.xmls #123

@gopackgo90

Description

@gopackgo90

I have com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider 2.10.0 installed in an OSGi environment without com.fasterxml.jackson.module.jackson-module-jaxb-annotations installed since it is optional for OSGi environments. However, when I declare com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider as a dependency in my Maven project, the org.apache.felix:maven-bundle-plugin generates the Import-Package section of my MANIFEST.MF for my project's bundle as, in part:

javax.xml.bind;version="[2.3,3)",javax.xml.bind.annotation;version="[2.3,3)"

Which is a problem for me since my OSGi environment only provides javax.xml.bind 2.1.0. This prevents my bundle from starting. I can work around this by excluding com.fasterxml.jackson.module:jackson-module-jaxb-annotations in my pom:

<dependency>
    <groupId>com.fasterxml.jackson.jaxrs</groupId>
    <artifactId>jackson-jaxrs-json-provider</artifactId>
    <version>2.10.0</version>
    <scope>provided</scope>
    <exclusions>
        <exclusion>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-jaxb-annotations</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Which then causes the Import-Package part of my MANIFEST.MF to be written as:

javax.xml.bind,javax.xml.bind.annotation

which works with my OSGi environment.

An alternative to me excluding com.fasterxml.jackson.module:jackson-module-jaxb-annotations from my dependency decleration would be having com.fasterxml.jackson.module:jackson-module-jaxb-annotations marked as an optional dependency in the com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider project. When that is the case I get the same result in my Import-Package as I get when I explicitly exclude com.fasterxml.jackson.module:jackson-module-jaxb-annotations.

I'm unsure if there is a reason com.fasterxml.jackson.module.jaxb is marked as optional in the osgi section of the pom, while the com.fasterxml.jackson.module:jackson-module-jaxb-annotations dependency is not also marked as optional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.xFor Jackson 3.x features, fixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions