# Optional dependency on ServiceDesk API

**URL:** <https://community.developer.atlassian.com/t/optional-dependency-on-servicedesk-api/13834>\
**Category:** Jira Server\
**Tags:** jira-service-management\
**Created:** [January 22, 2018, 8:49pm UTC](https://community.developer.atlassian.com/t/optional-dependency-on-servicedesk-api/13834 "2018-01-22T20:49:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![konrad.garus1](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/konrad.garus1/32/36247_2.png) [@konrad.garus1](https://community.developer.atlassian.com/u/konrad.garus1)\
**Post date:** [January 22, 2018, 8:49pm UTC](https://community.developer.atlassian.com/t/optional-dependency-on-servicedesk-api/13834/1 "2018-01-22T20:49:50Z")

</div>

I’m working on a plugin that mostly only uses Jira Core, but sometimes should do a small extra thing for the Service Desk. Is it possible to build it so that the same Marketplace app, from the same Jar, would work on Jira without SD _and_ provide some extra features when running with SD?

Obviously I can’t just inject SD services into my components, because such classes would not even load.

Is this even possible? How to achieve it?

---

<div class="post-metadata">

**Author:** ![nmansilla](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/nmansilla/32/33772_2.png) [@nmansilla](https://community.developer.atlassian.com/u/nmansilla)\
**Post date:** [January 22, 2018, 11:41pm UTC](https://community.developer.atlassian.com/t/optional-dependency-on-servicedesk-api/13834/2 "2018-01-22T23:41:30Z")

</div>

When you create an app listing on Marketplace, you have an option of marking the app as compatible with JSD.

 ![image](https://global.discourse-cdn.com/atlassiandeveloper/original/3X/7/a/7a395c162046b97bd3367556e50dbf002ff113d3.jpg)

---

<div class="post-metadata">

**Author:** ![konrad.garus1](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/konrad.garus1/32/36247_2.png) [@konrad.garus1](https://community.developer.atlassian.com/u/konrad.garus1)\
**Post date:** [January 23, 2018, 5:19pm UTC](https://community.developer.atlassian.com/t/optional-dependency-on-servicedesk-api/13834/3 "2018-01-23T17:19:20Z")

</div>

Thanks. I’m aware of this, but it’s not the question I’m asking.

My question is related to plugin development. Is it possible to build it so that the same Marketplace app, from the same Jar, would work on Jira without SD and provide some extra features when running with SD, using SD services?

---

<div class="post-metadata">

**Author:** ![vasiliy.krokha](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/vasiliy.krokha/32/48600_2.png) [@vasiliy.krokha](https://community.developer.atlassian.com/u/vasiliy.krokha)\
**Post date:** [January 23, 2018, 9:15pm UTC](https://community.developer.atlassian.com/t/optional-dependency-on-servicedesk-api/13834/4 "2018-01-23T21:15:15Z")

</div>

I’d assume that those additional JSD features will be triggered from JSD UI? If so then you can just rely on the fact that when you need a JSD service it will be available for you.

Another thing is when you want different behavior in Jira Core. Then one of the common approaches is to create a web resource condition and load specific resources for a particular case. In the condition you can use PluginManager to identify e.g. service-desk-api plugin which part of JSD app.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![daniel](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/daniel/32/35798_2.png) [@daniel](https://community.developer.atlassian.com/u/daniel)\
**Post date:** [January 24, 2018, 1:35am UTC](https://community.developer.atlassian.com/t/optional-dependency-on-servicedesk-api/13834/5 "2018-01-24T01:35:56Z")

</div>

These are a bit old - but take a look at:

[https://bitbucket.org/bwoskow/optional-service-sample-plugin](https://bitbucket.org/bwoskow/optional-service-sample-plugin)

> **[How can I configure component imports as optional](https://community.atlassian.com/t5/Answers-Developer-Questions/How-can-I-configure-component-imports-as-optional/qaq-p/548497)**
>
> Hello, I have a little (or not so little?) problem. I develop a plugin using components from the Subversion and Git plugin. But often only one of these plugins are installed. How can I manage this? If I configure both component import the start of...

---

<div class="post-metadata">

**Author:** ![konrad.garus1](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/konrad.garus1/32/36247_2.png) [@konrad.garus1](https://community.developer.atlassian.com/u/konrad.garus1)\
**Post date:** [January 24, 2018, 7:49am UTC](https://community.developer.atlassian.com/t/optional-dependency-on-servicedesk-api/13834/6 "2018-01-24T07:49:27Z")

</div>

Thanks guys. Daniel’s solution looks very promising, that’s probably what I’m looking for.
