VersionReleaseEvent not fired using VersionManager from Jira Java API

I am using releaseVersion of VersionManager. Somehow it looks like the VersionReleaseEvent is not automatically fired when calling this releaseVersion method. But I want to use ScriptRunner listening to this event VersionReleaseEvent.

Can somebody confirm, that I have to take care about this event myself?

There is only little documentation on custom events for Jira development. I am not sure, if it is really only use the constructor of VersionReleaseEvent and publish it via EventPublisher?

Or would you propose to use another Java API call to release a version?

Thank you very much in advance if you have ideas on this topic!

Best regards

I have NOT used the VersionManager#releaseVersion method myself. However, I regularly screw with the events so I can answer that portion:

def applicationUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser

def projectService = ComponentAccessor.getComponent(ProjectService)
def projectResult = projectService.getProjectById(applicationUser, 18911L)
def project = projectResult.project
def versionService = ComponentAccessor.getComponent(VersionService)
def sourceVersions = versionService.getVersionsByProject(applicationUser, project).versions
def eventPublisher = ComponentAccessor.getComponent(EventPublisher) "Publishing events for unarchived, unrelased versions in ${project.key}."
sourceVersions.each {
	def version = it as Version
    if(version && ! version.archived && ! version.released){
		eventPublisher.publish(new VersionUpdatedEvent(version, version))

Thank you very much! This looks pretty straight forward. :slight_smile:

Looking at VersionManager source code, the creation of the event is part of the releaseVersion method.

package com.atlassian.jira.project.version; /...
public class DefaultVersionManager implements VersionManager { 

    // ---- Release Version methods ----
    public Version releaseVersion(final Version version, final boolean release) {
        releaseVersions(Collections.singleton(version), release);

        final Version updatedVersion = getVersion(version.getId());
        if (release) {
            eventPublisher.publish(new VersionReleaseEvent(updatedVersion));
        } else {
            eventPublisher.publish(new VersionUnreleaseEvent(updatedVersion));
        return updatedVersion;

1 Like