Bitbucket Server With Jira Integration

I am writing a plugin in Bitbucket Server.
How can I connect to application links without using the REST API with Jira Server?
Is there a solution for this?

Take a look at this documentation as this might be helpful.

Ah sorry I got it backwards when reading. Try this documentation and let me know if that is helpful

Hi @umitdemirel.ozgenpls,
I believe you should be able to import the ApplicationLinkService into your plugin and then use its API to retrieve the available JIRA ApplicationLink. The ApplicationLink will give you access to the authenticated request factory to query JIRA.

Hope that helps!


1 Like

Hi @umitdemirel.ozgenpls,
Could you provide a bit more context?

What do you mean it’s not running? Is the service not getting wired into your constructor? How are you defining the Spring bean? Is the merge check not being executed? How are you configuring it?

May I ask, what are you trying to achieve in your merge check?

Juan Palacios

No one has any idea what ‘it did not work’ means. You need to show us what you mean. Are you seeing errors? Are you seeing bugs? What are you seeing?

Hi @umitdemirel.ozgenpls,

Depending on what you are trying to achieve in your check this may be advisable or not. You’ll need to keep in mind that these checks will execute whenever a user opens a pull request so you don’t want to have very heavy operations running that often. They will also execute when a user clicks the pull request Merge button and they will have to wait until the checks complete before the merge takes place and they get a result for the operation. So you don’t want to have very long running operations in those checks.

I’m not saying “don’t use them”. I don’t know what type of checks you’ll be performing, so I’m giving you context so you can decide whether it’s advisable or not.

That being said, in order to get your merge check to run you’ll need to configure a couple of things. From the code you’ve shared so far you’ve mixed a couple of approaches together so I’ll try and get you going with one (the 100% Spring one).

Remove the @Inject and @ComponentImport annotations. Instead add @Component("myMergeCheck") to the class and @Autowired to the constructor.

Configure OSGi to import the ApplicationLinkService for usage in your plugin. Create a file with the path src/main/resources/META-INF/spring/atlassian-plugins-component-imports.xml and add:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

    <osgi:reference id="applicationLinkService" interface="com.atlassian.applinks.api.ApplicationLinkService"/>


Configure spring to scan your classes by adding src/main/resources/META-INF/spring/atlassian-plugin-components.xml with:

<?xml version="1.0" encoding="UTF-8"?>

    <context:component-scan base-package="com.atlassian.bitbucket.plugin.mymergecheck"/> <!-- THIS SHOULD BE THE BASE PACKAGE FOR YOUR PLUGIN CLASSES -->


In src/main/resources/atlassian-plugin.xml make sure your merge check is added like this:

<repository-merge-check key="my-merge-check-key" configurable="false"
        class="bean:myMergeCheck" />

With that done (and assuming the rest of your plugin configuration is correct) you will have:

  1. Imported the ApplicationLinkService into your plugin
  2. Configured your merge check as a Spring bean with the ApplicationLinkService as a dependency
  3. Configured the merge check Spring bean as a repository merge check available to the system

Hope this helped out.