Starting with version 2.3.7-J7 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.
Project Configurator must be installed and licensed in your instance.
Once your code has been compiled, if you want to test it, it is necessary to have Project Configurator (version 2.3.7-J7 or higher) installed and licensed in your development instance. Project Configurator jar files can be downloaded from the Marketplace.
For development purposes, it is possible to license Project Configurator with some of the timebomb licenses for app developers.
No matter if you are driving Project Configurator from a Groovy script or a Java class, you will need the Javadoc for understanding what classes, methods, etc, are available. The javadoc jars for each version of the API are published at Adaptavist External Maven repository, at this URL:
In order to use the services of Project Configurator you need to get an instance of the interface that provides the required operation:
In the examples below, those instances have been retrieved using a call to
Project Configurator is able to run most operations in two modes: asynchronous and synchronous.
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 looking at the previous section with the Groovy script examples, as those examples have been created with a coding style that is highly compatible with Java.
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:
Do not use versions of the API older than 1.3.0. Those earlier versions were intended only for internal use and will not work with the examples in this page.
The jar artifact for the API is available from the same Maven repository as the javadocs. If you want to access that Maven repository add these lines to your pom.xml:
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.
If your app is not using the Atlassian Spring Scanner, then you must declare in its atlassian-plugin.xml file that it will import the components you need to run exports, imports or other operation. For example, if you want to export configurations or obtain the graph of dependencies for configuration objects, you would need to add this line:
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:
This example has a simple approach to error handling.