To start using Structure in your plugin:
Add dependency to your pom.xml
Figure out the version of the API that you need – it may depend on your JIRA and Structure plugin version.
To use API classes, add the following dependency:
<dependency> <groupId>com.almworks.jira.structure</groupId> <artifactId>structure-api</artifactId> <version>17.0.0</version> <scope>provided</scope> </dependency>
Note that there are Additional Libraries Used in Structure API
Import StructureComponents
In your atlassian-plugin.xml
, use <component-import>
module to import StructureComponents
service. This service provides access to all other Structure services.
Alternatively, you can import specific services.
<component-import key="structure-components" interface="com.almworks.jira.structure.api.StructureComponents"/>
Have Structure API service injected into your component
public class MyClass { private final StructureManager structureManager; public MyClass(StructureComponents structureComponents) { structureManager = structureComponents.getStructureManager(); } ... }
This is it! Continue to the list of Structure Services to see which service you need to work with. Other articles in this section provide examples for specific use cases.
For a production plugin, consider Controlling Compatibility. For a standalone plugin, which can work without Structure, read about Making Structure Dependency Optional.