Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this page:

Table of Contents
minLevel1
maxLevel6
outlinefalse
styledefault
typelist
printabletrue

Overview

Starting with version 2.3.7 of Project Configurator, it is possible to use the app services from a Groovy script in Script Runner for Jira (SR4J) or from any Java program (another app, for example) running within the Jira instance.

...

For development purposes, it is possible to license Project Configurator with some of the timebomb licenses for app developers.

API Javadocs

Whether you are driving Project Configurator from a Groovy script or a Java class, you will need Javadoc to understand what classes, methods, etc., are available. The Javadoc jar files for each version of the API are published in our External Maven repository.

Info

From Project Configurator version 3.3.1, the method getExportedFile from the interface ExportResult is deprecated. The method getExportedReturnFile should be used instead. This new method returns the export configuration file directly, so it is no longer necessary to write the XML string to a file. See our Java and Groovy examples.

Using Project Configurator from a Groovy script in ScriptRunner for Jira

To use Project Configurator’s services, you need to get an instance of the interface that provides the required operation:

...

  • Methods that run in synchronous mode are explicitly marked in their name (like exportSynchronous(…​) ).

  • On the other hand, methods that run asynchronously do not have any special name (like export(…​) ).

Using Project Configurator from Java

Using Project Configurator from Java code (i.e., another app) has some extra requirements relative to usage from a Groovy script in SR4J. These specific requirements are described below.

It is also useful to look at the previous section with Groovy script examples, as those examples have been created with a coding style that is highly compatible with Java.

Add dependency in the pom.xml

First of all, you need to declare in your pom.xml file that your code depends on this API. This only requires adding this dependency to the XML:

...

Code Block
<repository>
<id>adaptavist-external</id>
<url>https://nexus.adaptavist.com/content/repositories/external</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
</repository>

Access API components from your Java code

As mentioned, for the Groovy scripts, you will need to get the component objects that implement the API. This can be done in a variety of ways.

Declare the imported components in atlassian-plugin.xml

If your app is not using the Atlassian Spring Scanner, you must declare in its atlassian-plugin.xml file that it will import the components you need to run exports, imports, or other operations. For example, if you want to export configurations or obtain the graph of dependencies for configuration objects, you would need to add this line:

...

Code Block
<component-import key="projectConfigExporter" 
interface="com.awnaba.projectconfigurator.operationsapi.ProjectConfigExporter"/>

Using Atlassian Spring Scanner

In this case, you can inject the required dependencies to the API objects without the need to add an explicit component import declaration in atlassian-plugin.xml. Using the correct annotations will be enough:

...