Generating a link to your issue tracker with IntelliJ

Sometimes it’s a good practice to post a commit message to your VCS (version control system), including a pattern with the issue number.

For example, you could commit changes towards Git or Subversion, with this commit message : « I fixed this nasty bug : #123 ».

And it could be nice to automatically generate a link to your issue tracker directly inside your favorite Java IDE.

Here’s how to do with IntelliJ IDEA :

  • Go to File > Settings > Version Control > Issue Navigation
  • Then add an item : here you have to fill in the issue ID (regex), and the issue link that will be generated (regex with replacement of the capturing group)

The dialog box you’ll get looks like this :


If you want to capture just a part of the regex, you can use the capturing groups.
Let’s say the pattern you use is « #issue-number », but you want to exclude the « # » from the URL generated. So in this case you will use a regex with one non-capturing group, and a capturing group.
So the issue ID regex will be : (?:#)([0-9]+)
And the issue link will be : http://my-issue-tracker/$1

That way, you’ll be able so see a clickable link in the Version Control window (ALT+9).

See also :