Rocktronic
Project Groups for Jira logo

Project Groups for Jira Java API

The application provides ProjectGroupService for basic actions with groups, such as creating, searching, editing groups, adding projects to a group, etc.

For reference, see javadoc.

If you have problems using the API, please ask a question in our help center.

Use with ScriptRunner

The Java API is used with the ScriptRunner for Jira in accordance with its documentation. To work with the API, you need to use the @WithPlugin and @PluginModule annotations. Here is an example of a simple groovy script that you can run in the ScriptRunner console:

import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import systems.npe.jira.prjorg.controller.java.ProjectGroupService

@WithPlugin("systems.npe.jira.prjorg")
@PluginModule
ProjectGroupService projectGroupService;

projectGroupService.getGroupsList().forEach(group -> log.warn group)
groovy

Use in your plugin

Here are the recommended steps for comfortable work with the Project Groups for Jira Java API in your plugin:

1. Download your version of the Project Groups for Jira app.

2. Add it to your local Maven repo with command:

atlas-mvn install:install-file -Dfile=prjorg-X.Y.Z.jar -DgroupId=systems.npe.jira -DartifactId=prjorg -Dversion=X.Y.Z -Dpackaging=jar

Where X.Y.Z is your Project Groups for Jira version number.

3. Add dependency to the pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project>
...
    <dependencies>
    ...
        <dependency>
            <groupId>systems.npe.jira</groupId>
            <artifactId>prjorg</artifactId>
            <version>X.Y.Z</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    ...
</project>
xml

4. Add app packages to the Import-Package instruction of the Jira Maven Plugin:

<?xml version="1.0" encoding="UTF-8"?>
<project>
    ...
    <build>
        <plugins>
            ...
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>jira-maven-plugin</artifactId>
                <configuration>
                    <instructions>
                        <Import-Package>
                            systems.npe.jira.prjorg.controller.java.*;resolution:="optional",
                            systems.npe.jira.prjorg.entity.*;resolution:="optional",
                        </Import-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
xml

5. Now you can inject systems.npe.jira.prjorg.controller.java.ProjectGroupService to your classes using @JiraImport annotation.