It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Plugin dependency to multiple versions?

Hi!

Is it possible to build a plugin with a dependency to any other plugin compatible to two different major versions?

The SDK builds a manifest file using the maven dependency major version. So I cannot create a plugin which is compatible to two major versions of another plugin. I tried a lot of configurations without success (e.g. Require-Bundle, Import-Package, DynamicImport-Package in pom.xml; Import-Package in atlassian-plugin.xml; using jar or obr files). In this special case I need a dependency to the Confluence Create Content plugin (Confluence bundled one), which is bundled in version 2 until CF 5.4, but in version 4 since the new CF 5.5. The error message looks like:

missing requirement [205.0] package; (&(package=com.atlassian.confluence.plugins.createcontent.actions)(version>=2.0.0)(!(version>=3.0.0)))

Any idea?

2 answers

1 accepted

1 vote
Answer accepted

The following solution seems to be working:

<Import-Package>
com.atlassian.confluence.plugins.createcontent.*;version="${create-content-plugin.version}",
    *;resolution:=optional
</Import-Package>

Note the addional "*"-package, otherwise all other imported packages thrown out. Adding "optional" was also necessary - the package identification mechanism of the Atlassian SDK also mark all packages in my plugins as optional within the generated manifest. Otherwise you get other error messages regarding dependenies during installation of the plugin.

Some documentation: https://developer.atlassian.com/display/DOCS/Managing+Dependencies#ManagingDependencies-UsingContainer-providedPackages

Hope this helps anyone running into the same problem.

The additional "*" is the solution. This helped ma a lot - although I don't have a clue why :) Thanks a lot!

Hi Mirko,

Have you tried using ImportPackage (or DynamicImportPackage) with a specified range including the two versions? As it seems by the error mesage the requirement is for versions [2.0.0,3.0.0). You may try some like this - from 2.0.0 to 5.0.0 exclusive:

<configuration>
  ...
  <instructions>
    <Import-Package>
      com.atlassian.confluence.plugins.createcontent.actions*;version="[2.0.0,5.0.0)"
    </Import-Package>
  </instructions>
</configuration>

Hi George,

Thanks for you answer! In the meantime I found a solution that works. Yes, adding this is correct!!" But all other imported packages thrown out. See my answer for the complete solution.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Off-topic

Atlassian Community Guide to A+ Articles

Stop: Articles and permission Article-writing permissions are given to Leaders, Marketplace Vendors, Solutions Partners, Atlassian Team members, and those who are Level 4 + above. But for any aspir...

90 views 9 11
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you