OSGI cannot import Greenhopper package

I am developing plugin for Jira Data Center and currently i have version 10.0.0 (to be specific * v10.0.0-m0004) and i am using GreenHopperCacheManager to handle some caches in my plugin, and in order to use that class i have this in my pom.xml

<Import-Package>com.atlassian.greenhopper.*; resolution:="mandatory", *</Import-Package>

but when i try to upload i have following error

Unable to resolve resource com.adriian.myplugin because it is exposed to package 'javax.ws.rs' from resources com.atlassian.plugins.rest.atlassian-rest-module [com.atlassian.plugins.rest.atlassian-rest-module [158](R 158.0)] and com.atlassian.plugins.rest.atlassian-rest-v2-plugin [com.atlassian.plugins.rest.atlassian-rest-v2-plugin [159](R 159.0)] via two dependency chains.
    Chain 1:
      com.adriian.myplugin [com.adriian.myplugin [264](R 264.0)]
        import: (osgi.wiring.package=javax.ws.rs)
         |
        export: osgi.wiring.package: javax.ws.rs
      com.atlassian.plugins.rest.atlassian-rest-module [com.atlassian.plugins.rest.atlassian-rest-module [158](R 158.0)]
    Chain 2:
      com.adriian.myplugin [com.adriian.myplugin [264](R 264.0)]
        import: (osgi.wiring.package=com.atlassian.greenhopper.service)
         |
        export: osgi.wiring.package=com.atlassian.greenhopper.service; uses:=javax.ws.rs
      com.pyxis.greenhopper.jira [com.pyxis.greenhopper.jira [190](R 190.0)]
        import: (osgi.wiring.package=javax.ws.rs)
         |
        export: osgi.wiring.package: javax.ws.rs
      com.atlassian.plugins.rest.atlassian-rest-v2-plugin [com.atlassian.plugins.rest.atlassian-rest-v2-plugin [159](R 159.0)] Unresolved requirements: [[com.adriian.myplugin [264](R 264.0)] osgi.wiring.package; (osgi.wiring.package=com.atlassian.greenhopper.service)].  This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see https://developer.atlassian.com/x/mQAN

and because of that error i dont have GreenHopperCacheManager bean in context.
I`ve found similiar issue but related to Confluence, but as @MarekTokarski said, it was on Confluence side.
@MarekTokarski or anyone else , do you know something about this or how it can be fixed

Hi @AdriianSemotiuk ,

It sounds like you’re encountering an OSGi dependency resolution issue. As far as i know this error often occurs when there are conflicting dependencies or version constraints.

Maybe this few steps will help you to resolve your problem.

1. Check Dependencies

Ensure that all dependencies in your pom.xml are correctly specified and compatible with Jira Data Center v10.0.0. You might need to update or exclude certain dependencies to avoid conflicts.

2. Use Exclusions

You can use exclusions in your pom.xml to exclude specific transitive dependencies that might be causing the conflict:

<dependency>
    <groupId>com.pyxis.greenhopper</groupId>
    <artifactId>greenhopper-jira</artifactId>
    <version>6.3.12</version>
    <exclusions>
        <exclusion>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
        </exclusion>
    </exclusions>
</dependency>

3. Update Plugin Dependencies

Make sure that all your plugin dependencies are up-to-date and compatible with Jira Data Center v10.0.0. You can check the Atlassian Marketplace or the official documentation for the latest versions.

4. Check for OSGi Headers

Ensure that your plugin’s atlassian-plugin.xml file is correctly configured with the necessary OSGi headers:

<atlassian-plugin key="com.adriian.myplugin" version="1.0">
    <plugin-descriptor key="com.adriian.myplugin" version="1.0">
        <requires>
            <import package="javax.ws.rs" version="1.0.0" />
            <import package="com.atlassian.greenhopper.service" version="1.0.0" />
        </requires>
    </plugin-descriptor>
</atlassian-plugin>

I hope these steps may help you to resolve the issue!

Chears,
Daniel