This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This repository contains sample ScriptRunner plugins for Atlassian products (Jira, Confluence, and Bitbucket). These plugins demonstrate how to create custom scripts that extend Atlassian product functionality using Groovy.
Reference documentation:
The repository is organized as a multi-module Maven project:
├── jira/ - Jira ScriptRunner samples
├── confluence/ - Confluence ScriptRunner samples
└── bitbucket/ - Bitbucket ScriptRunner samples
Each module:
- Uses product-specific parent POMs from Adaptavist (e.g.,
scriptrunner-jira-standard,scriptrunner-confluence-standard,scriptrunner-bitbucket-standard) - Contains Groovy scripts in
src/main/resources/com/adaptavist/andsrc/main/resources/com/example/ - Has integration tests in
src/test/groovy/it/com/adaptavist/using Spock framework - Packages as an
atlassian-plugin
These commands require:
- Atlassian SDK (
atlas-mvn) - Install following the Atlassian SDK documentation - Java 11 or later - The project is configured for Java 11 (Jira requires Java 11+)
Build all modules from the root:
atlas-mvn clean installBuild a specific product module:
cd jira
atlas-mvn clean installRun tests for a specific module:
cd jira
atlas-mvn integration-testRun a single test:
cd jira
atlas-mvn integration-test -Dit.test=CustomEventListenerITStart Jira with the plugin installed (in debug mode):
cd jira
atlas-mvn jira:debug -UStart Confluence with the plugin installed (in debug mode):
cd confluence
atlas-mvn confluence:debug -UThe -U flag forces Maven to update snapshots and releases from remote repositories, useful if parent POM versions have been updated.
Note on Bitbucket: Running Bitbucket locally requires additional setup (git server/sidecar configuration). The Bitbucket module can be built and tested, but running the full application may require extra infrastructure.
Each module contains a scriptrunner.yaml file in src/main/resources/ that defines:
- scriptListeners - Event listeners that react to product events
- restConfigItems - REST endpoint configurations
- fragmentConfigItems - UI customizations (web items, panels)
- scriptJobs - Scheduled jobs (Confluence/Jira)
- customSearchFields - Custom Confluence search fields
- cqlFunctions - Custom CQL functions
The YAML file references Groovy scripts via the scriptPath or clazz field (e.g., com/adaptavist/CustomEventListenerScript.groovy). ScriptRunner reads this descriptor and automatically registers the scripts with the Atlassian product.
Jira:
- Custom Event Listeners (e.g.,
CustomEventListenerScript.groovy) - React to Jira events like project creation - REST Endpoints (e.g.,
SampleRest.groovy) - Custom REST APIs usingCustomEndpointDelegate
Confluence:
- Custom CQL Functions (e.g.,
CustomCqlFunctionScript.groovy) - Extend Confluence Query Language - Custom Search Fields (e.g.,
CustomSearchFieldScript.groovy) - Add custom searchable fields - Custom Event Listeners (e.g.,
CustomEventListenerScript.groovy) - REST Endpoints (e.g.,
SampleRest.groovy)
Bitbucket:
- Pre-receive Hooks (e.g.,
SamplePreHook.groovy) - Validate commits before acceptance - REST Endpoints (e.g.,
SampleRest.groovy)
All scripts follow the ScriptRunner plugin pattern:
- Scripts are placed in
src/main/resources/with appropriate package structure - ScriptRunner automatically discovers and registers these scripts at runtime
- Scripts use
@BaseScriptannotation to declare their type (e.g.,CustomEndpointDelegatefor REST endpoints) - Event listener scripts access the event object via implicit
eventvariable
Integration tests use Spock framework and run against actual Atlassian product instances:
- Tests extend
Specificationclass - Use
@Sharedfor expensive-to-create objects - Access Atlassian APIs via
ComponentAccessor - Tests verify that script behaviors work correctly in the product context
- Parent POMs handle most dependencies automatically
- Custom dependencies can be added to each module's
pom.xml - All modules require access to the Adaptavist Nexus repository at
https://nexus.adaptavist.net/content/repositories/external
Current versions configured in module POMs:
- Parent POM version: 89 (scriptrunner-*-standard)
- Java: 17 (explicitly set via maven.compiler.source/target)
- Jira: 10.3.8 (requires Java 17 minimum)
- Confluence: 9.2.6 (supports Java 17 and 21)
- Bitbucket: 9.4.8 (bundles Java 17.0.13)
To change product versions, update the respective property in each module's pom.xml. If you encounter repository resolution issues with the parent POM, version 89 is known to work.
Note on Java versions: Jira 10.3+ was compiled with JDK 17 and does not support Java 8 or 11. All modules are configured to compile with Java 17 for maximum compatibility.
- The
ScratchScript.groovyfiles incom.examplepackage are templates for quick experimentation - Logging levels can be configured in each module's POM via the
logging.levelsproperty - Jira module includes optional configurations for Jira Software and Service Desk (commented out by default)
The repository has several branches with alternative configurations that may be useful references:
- Uses parent POM version 34 (much older than current 89)
- Older product versions: Jira 8.13.25, Confluence 7.13.9, Bitbucket 7.17.10
- Uses
https://nexus.adaptavist.cominstead ofhttps://nexus.adaptavist.net - Package paths use dots instead of slashes:
com.adaptavist/vscom/adaptavist/ - Tests extend
SrSpecificationinstead ofSpecification - Simplified scriptrunner.yaml files (removed REST, web items, jobs examples)
- May be useful if encountering listener registration issues
- Targets Jira 11.0.0 compatibility
- Completely different approach: uses JAR packaging instead of atlassian-plugin
- No parent POM dependency - manually defines all dependencies
- Includes Java service implementation with Jakarta Inject for JDK 21
- Uses custom MANIFEST.MF
- Represents a fundamentally different plugin architecture
- Updates for Platform 7 compatibility
- Bumps Bitbucket to latest Platform 7 supported version
- Master is currently at parent POM version 90 (may have resolution issues)
- Version 89 (current) is stable
- Many intermediate versions (88, 87, 86...) are available in commit history