Jira plugin cache problem

I’ve recently realized that each time I uninstall and reinstall the same plugin with updated logic, the old one still runs. Let’s say in the IssueUpdate event listener I have the following piece of code:

  System.out.println("Hello world");

and then I change it to

  System.out.println("Weird world");

I get both outputs. And if I change it further, the changes will be added to the old ones. So jira obviously caches them somewhere. But, if it caches them, why does it stop when I uninstall the plugin?

1 Like

That is definitely not the normal behavior. Did you try changing the version number to see if that makes a difference? Are you uploading the plugin via UPM or running it using atlas-run?

What plugin module are you using?

Yes, I’ve tried changing the version number.
I’m uploading it with UPM, through the admin panel
I don’t use any plugin module.

Not sure what the issue is. Could be due to some bug in the UPM version you are using. Never seen this one before.

Did you unsubscribe the event listener using the onStop(from SAL’s LifecycleAware) or destroy() (from Spring DisposableBean ) methods?


Hmmm nouuuuuu. Should I? When should I do it?

1 Like

Try something like this:

public class Foo implements InitializingBean, DisposableBean {

    private final EventPublisher eventPublisher;

    public Foo(EventPublisher eventPublisher) {
        this.eventPublisher = eventPublisher;

    /** Called when the plugin has been enabled */
    public void afterPropertiesSet() {

    /** Called when the plugin is being disabled or removed */
    public void destroy() throws Exception {

    public void onBlah(BlahEvent event) {

…and don’t forget to register the class as a component in your atlassian-plugin.xml file:

<component key="myFoo" class="com.example.Foo" />

… oh, and also import the EventPublisher component:

    <component-import key="eventPublisher"
        interface="com.atlassian.event.api.EventPublisher" />

In fact, I don’t do this as per the documentation for the latest SDK. The spring scanner.takes care of it automatically. I use the combination of @ComponentImport and @Autowired annotations to achieve this.

1 Like