Skip to content

The Gradle plugin does not exclude java.* from Import-Package anymore #6879

@jonatan-ivanov

Description

@jonatan-ivanov

6.4.x versions of the plugin did exclude java.* from Import-Package while 7.1.x does not.

For Example doing this using 6.4.x:

jar {
    bundle {
        bnd '''\
        Import-Package: \
            javax.annotation.*;resolution:=optional;version="${@}",\
            *
        '''.stripIndent()
    }
}

Results in this:

Import-Package: javax.annotation;resolution:=optional;version="3.0.2",
javax.annotation.meta;resolution:=optional;version="3.0.2"

But on 7.1.x, Import-Package also contains this:

java.io,java.lang,java.lang.annotation,java.lang.invoke,java.lang.management,java.lang.ref,java.lang.reflect,java.math,java.net,java.nio,java.nio.charset,java.sql,java.text,java.time,java.time.format,java.time.temporal,java.util,java.util.concurrent,java.util.concurrent.atomic,java.util.function,java.util.logging,java.util.regex,java.util.stream,java.util.zip,

A workaround could be excluding java.*:

jar {
    bundle {
        bnd '''\
        Import-Package: \
            !java.*,\
            javax.annotation.*;resolution:=optional;version="${@}",\
            *
        '''.stripIndent()
    }
}

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