Integrating with custom JIRA issue key in Bitbucket Server


アトラシアン コミュニティをご利用ください。



JIRA has a UI to help specify a custom issue key format. When integrating with Bitbucket Server, these custom JIRA issue keys are not recognized by Bitbucket Server, and hence commits are not linked to the JIRA issues.


Bitbucket Server passes commit messages through a regex pattern to identify and create links. The custom JIRA issue key format will not work with the default pattern that Bitbucket Server is shipped with. This regex has changed over time, multiple versions are provided below.

Version 3.11+
Version 3.10 and below


Follow the steps below to modify the regex pattern:

1) Shut down Bitbucket Server.

2) Edit the contents of the <Bitbucket Server installation directory>/bin/ or <Bitbucket Server installation directory>/bin/setenv.bat (depending upon your OS) and add the modified regex to the variable JVM_SUPPORT_RECOMMENDED_ARGS.

3) Save the file.

4) Remove the contents of the following folder:

バージョンFolder location
Up to 2.10.x<BITBUCKET_HOME>/caches/idx-snapshots
2.11 以降<BITBUCKET_HOME>/data/snapshots
3.2 以降<BITBUCKET_HOME>/shared/data/snapshots

5) Restart Bitbucket Server.

6) Push to the repository with the JIRA issue key in the commit message to force a reindex of the data.

For example, to match JIRA keys such as C001-1 or ABC123-1, set the variable as follows:

2.8 よりも前


2.8 以降


5.0 以降


To match JIRA both uppercased and lowercased JIRA keys, set the variable as follows:


5.0 以降


setenv and environment variable changes in Bitbucket Server 5.0+

Starting with Bitbucket Server 5.0, and setenv.bat have been removed. The options that were set in this file can now be set via environment variables. Where to set the environment variable depends on which Operating System you're running on.


When using the atlbitbucket service on Linux, the environment variables are ignored. You must set the parameters in (or These values will be read when the service starts.

As an example, to set JVM_SUPPORT_RECOMMENDED_ARGS, you would add this line to the file:



Set the parameter as an environment variable for the user running Bitbucket Server. For example, if you want to set JVM_SUPPORT_RECOMMENDED_ARGS, create it as an environment variable and assign the appropriate value to it. When Bitbucket Server starts using the startup scripts or service, it will pick up and apply this value.

If the parameter is set correctly the following line will be logged in the <BITBUCKET_HOME>/log/atlassian-bitbucket.log:

c.a.i.i.jira.PatternJiraKeyScanner Using custom Jira key pattern: ((?<!([A-Z0-9]{1,10})-?)[A-Z0-9]+-\d+)

Or the following in older versions of Bitbucket Server:

c.a.s.i.jira.idx.JiraKeyIndexer Using custom JIRA key pattern: ((?<!([A-Z0-9]{1,10})-?)[A-Z0-9]+-\d+)

(info) the regex in Bitbucket Server does not match exactly the one specified in JIRA, in Bitbucket Server it is required to add the -\d suffix to the JIRA one

Changing the Jira key pattern here does not affect the hyperlinks generated on commit messages, but only the indexed commit messages that are gathered to display issues in the 'Issues' column.

See the following for more details:

最終更新日 2021 年 8 月 24 日


Powered by Confluence and Scroll Viewport.