You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Francois Papon (Jira)" <ji...@apache.org> on 2020/07/04 13:43:00 UTC

[jira] [Resolved] (SHIRO-761) Bad OSGi import for javax.annotation in shiro-guice

     [ https://issues.apache.org/jira/browse/SHIRO-761?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Francois Papon resolved SHIRO-761.
----------------------------------
    Resolution: Resolved

> Bad OSGi import for javax.annotation in shiro-guice
> ---------------------------------------------------
>
>                 Key: SHIRO-761
>                 URL: https://issues.apache.org/jira/browse/SHIRO-761
>             Project: Shiro
>          Issue Type: Bug
>          Components: Integration: Guice
>    Affects Versions: 1.5.2
>            Reporter: Stuart McCulloch
>            Assignee: Francois Papon
>            Priority: Major
>             Fix For: 2.0.0
>
>         Attachments: SHIRO-761.patch
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> shiro-guice 1.5.2 declares the following OSGi import for javax.annotation:
> {code}
> javax.annotation;version="[3.0,4)"
> {code}
> This is incorrect, the latest spec version for javax.annotation is 1.3
> This appears to be caused by the javax.annotation dependency appearing below the guice dependency in support/guice/pom.xml. The guice dependency pulls in com.google.code.findbugs:jsr305:jar:3.0.2 and the maven-bundle-plugin takes that as the version to use for the javax.annotation import, rather than the javax.annotation-api dependency (version 1.3.2)
> The following minor patch fixes the import range by changing the order of the dependencies:
> {code}
> diff --git a/support/guice/pom.xml b/support/guice/pom.xml
> index 9d9e8b3..8217cfa 100644
> --- a/support/guice/pom.xml
> +++ b/support/guice/pom.xml
> @@ -46,6 +46,10 @@
>              <optional>true</optional>
>          </dependency>
>          <dependency>
> +            <groupId>javax.annotation</groupId>
> +            <artifactId>javax.annotation-api</artifactId>
> +        </dependency>
> +        <dependency>
>              <groupId>com.google.inject</groupId>
>              <artifactId>guice</artifactId>
>          </dependency>
> @@ -54,10 +58,6 @@
>              <artifactId>guice-multibindings</artifactId>
>          </dependency>
>          <dependency>
> -            <groupId>javax.annotation</groupId>
> -            <artifactId>javax.annotation-api</artifactId>
> -        </dependency>
> -        <dependency>
>              <groupId>com.google.inject.extensions</groupId>
>              <artifactId>guice-servlet</artifactId>
>              <optional>true</optional>
> {code}
> If you build the shiro-guice module before and after this fix then you should see the difference in support/guice/target/classes/META-INF/MANIFEST.MF



--
This message was sent by Atlassian Jira
(v8.3.4#803005)