A plugin can no longer listen for its own PluginUninstallingEvent since Atlassian Plugins 5

Prior to Jira 8 (and Atlassian Plugins 5), you were able to listen for the PluginUninstallingEvent of your plugin from within your plugin, giving you the opportunity to perform some cleanup before uninstalling. For example, a plugin installed from an Obr could also uninstall its accompanying plugins.

Following the Jira 8 upgrade (which I assume may be due to upgrading to Atlassian Plugins 5 too), the plugin is disabled and therefore completely unwired, before the PluginUninstallingEvent is published, making it impossible for a plugin to know when it is about to be uninstalled.

Is this intentional or an untested side-effect of changes in the platform?

It seem we are also unable to submit bugs to the plugin project in the Atlassian Ecosystem Jira too, so instead i’m posting here, in the hope that someone from the Atlassian plugins team can help.


You’ll probably want to use @PreDestroy or DisposableBean. See the docs for more information:


I’ve submitted this as a bug, with an example for context, which I’ll repost here for clarity…

public class Cleanup {

    private final EventPublisher eventPublisher;

    private final PluginRetrievalService pluginRetrievalService;

    public Cleanup(EventPublisher eventPublisher,
                   PluginRetrievalService pluginRetrievalService) {
        this.eventPublisher = eventPublisher;
        this.pluginRetrievalService = pluginRetrievalService;

    public void register() {

    public void unregister() {

    public void onPluginUninstallingEvent(PluginUninstallingEvent event) {
        final Plugin obr = pluginRetrievalService.getPlugin();

        if (event.getPlugin().equals(obr)) {
            // DO SOME CLEANUP HERE

The cleanup is something that should be done only on the deliberate uninstallation of the plugin, not just when it disables, and esp not when it upgrades.

And this worked perfectly fine pre Jira 8.

1 Like

I see. Once you find a solution I guess these people would be interested as well.

1 Like

Hi Everyone,

A product issue is created for this. Please see progress in https://ecosystem.atlassian.net/browse/AMPS-1503