Managing a plugin for both Jira Core and Jira Service Desk

We have a plugin for Jira, but we are intending on soon extending the functionnalities to be used with Service Desk (server version).

We will have to do some development and use the Service Desk Java API. The question I had was about the plugin compatibility with a Jira instance that does not have Service Desk.

For example, if in my plugin I inject the PrioritySchemeManager in one on my classes with OSGI, the plugin installs fine on Jira 7.6.0+, but fails on earlier version because it does not find the class. My fear is that if I start injecting services from the Service Desk API, we might be unable to install it on Jira instances that does not have Service Desk (either just Jira Core or Jira Software). How do we manage this?

Take a look at Optional dependency on ServiceDesk API . Basically you’re going to have to abstract the service out.

If I understand correctly, I should create a service that is not exposed as a service, and a custom class that will act a an accessor and will keep an instance of my service (if Service Desk is detected). That accessor will return either null or the instance of my service and then will be available for use. This might work.