Configuration of Instructions in Atlassian Plugins

Default plugin instructions

If you create a new plugin with the Atlassian SDK (for instance using atlas-create-confluence-plugin), you'll find the following instructions already configured for you:

  <!-- Add package to export here -->
  <!-- Add package import here -->
    org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", *
  <!-- Ensure plugin is spring powered -->

Here's what these default instructions do:

Tag Default Value Purpose
Atlassian-Plugin-Key Maven group and artifact Marks your plugin as providing its own Spring configuration, rather than one being created during the transformation process. This is so-called 'transformerless', and results in significantly faster deployment and startup time of your plugin.
Export-Package Your API package Tells the underlying OSGi framework to expose these classes outside your plugin. Without it, you would get ClassNotFoundExceptions when other plugins attempted to load your API classes.

Optional backend frameworks

Catch-all wildcard

In order to provide Spring functionality in an OSGi container, we use a third party framework. Originally this was Spring DM, but in the latest Atlassian Plugins version we migrated to its successor, Gemini Blueprints. Marking both as 'optional' means your plugin can find the classes it needs it both new and old Atlassian products. The final asterisk is a catch-all to ensure your plugin can access all the classes it needs, and is resolved at build time by utility called 'bnd'.

If you remove the optional imports, bnd would instead generate mandatory imports for both Spring OSGi frameworks, meaning your plugin would fail to resolve and start in both newer and older products.

Spring-Context Catch-all wildcard This is simply a safety measure to ensure your Spring context is loaded, even if there are no XML files in your META-INF/spring directory.


Was this page helpful?
Powered by Confluence and Scroll Viewport