Properly depending on Jira Automation Rules plugin

I have a plugin adding components to our instance using automation-thirdparty-sample as guidance.

When we update Jira Automation Rules without restarting our custom plugin, all rules start failing with “NoClassDefFound” errors.

How do I properly make my plugin depend on Jira Automation Rules to more gracefully handle this? This is a very confusion situation for our server operators but I’m unsure what i’ve missed to make this work as you’d expect.

I’m not sure if there is a better way, but we have a optional dependency on portfolio and there we solve this issue with reflections.

ClassLoader classLoader = ComponentAccessor.getPluginAccessor().getClassLoader();
Class hierarchyApiClass = classLoader.loadClass("com.atlassian.rm.portfolio.publicapi.interfaces.hierarchy.HierarchyLevelAPI");
Optional<Object> hierarchyLevelAPI = Optional.ofNullable(ComponentAccessor.getOSGiComponentInstanceOfType(hierarchyApiClass))
1 Like

I’ll try this out, we seem to be able to very reliably reproduce the issue. Thanks for the suggestion, I’ll follow up. We also put a ticket into PS, so I can share whatever we learn.

Since I have a mandatory requirement on the Automation for Jira plugin, I think it’s this:

A “pluginArtifacts” reference is present in the sample, but I do not have it in my own plugin. I’ll try it out and test it.