Tutorial: how to create an obr with dependent jar inside

While developing a Jira plugin for Jira Server/Data Center we sometimes need to include a dependency inside our plugin because our Jira instance does not have the required dependency. To fulfill this requirement we could provide the Compile scope for the dependency and all classes from the dependency would be included in our jar file.

There is also another solution. We could add the dependency into the obr file of our plugin. And if we install our obr file into a Jira instance, our dependency will be also installed.

In this tutorial we will create two plugins. The first plugin is called jira-library. This plugin will have an exported service called LibraryService. This service will have only one method getLibraryMessage() which returns a text message “jira-library test message”. The second plugin will contain a servlet which calls getLibraryMessage() from the first plugin and prints out the text message to the user who invoked the servlet. We will build the sevlet plugin as an obr file with a jira-library jar file inside the plugin.

The source code of the two plugins is available here:



Let’s create jira-library plugin.

We need to execute the following command:


We will be asked to set several parameters for our plugin. I provide parameters with answers:

Define value for groupId: : ru.matveev.alexey.tutorial.library
Define value for artifactId: : jira-library
Define value for version: 1.0.0-SNAPSHOT: :
Define value for package: ru.matveev.alexey.tutorial.library: :
Y: : Y

After creating the plugin we need to add our LibraryService to the plugin. First we add the interface of our service (LibraryService.java file) to the ru.matveev.alexey.tutorial.library.api package:

package ru.matveev.alexey.tutorial.library.api;

public interface LibraryService {
String getLibraryMessage();

And then we add our service implementation to the ru.matveev.alexey.tutorial.library.impl package:

package ru.matveev.alexey.tutorial.library.impl;

import com.atlassian.plugin.spring.scanner.annotation.export.ExportAsService;
import ru.matveev.alexey.tutorial.library.api.LibraryService;

import javax.inject.Named;

public class LibraryServiceImpl implements LibraryService {
public String getLibraryMessage() {
return “jira-library test message”;

Then we create a jar file of the first plugin with:

altas-mvn package

We can see the jar file in the target directory of the jira-library folder.

Let’s create the second plugin.

Again we execute the following command:


And provide the following answers:

Define value for groupId: : ru.matveev.alexey.tutorial.obr
Define value for artifactId: : jira-obr
Define value for version: 1.0.0-SNAPSHOT: :
Define value for package: ru.matveev.alexey.tutorial.obr: :
Y: : Y

Then we go to the jira-obr folder and create a servlet module inside jira-obr plugin with the following command:


You need to provide the following answers:

Choose a number (1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/33/34): 21
Enter New Classname MyServlet: :
Enter Package Name ru.matveev.alexey.tutorial.obr.servlet: :
Show Advanced Setup? (Y/y/N/n) N: : N
Add Another Plugin Module? (Y/y/N/n) N: : N

Then add the following dependency in the pom.xml file:

ru.matveev.alexey.tutorial.library jira-library 1.0.0-SNAPSHOT system /home/alexm/atlasplugin/obr/jira-library/target/jira-library-1.0.0-SNAPSHOT.jar

Change /home/alexm/atlasplugin/obr/jira-library/target/jira-library-1.0.0-SNAPSHOT.jar to the real path to your jira-library-1.0.0-SNAPSHOT.jar.

I chose to save the jar file in the file system because in this case I do not need to install a repository manager to save my jar file. But in real life you should save your jar files in a repository manager like Artifactory or Nexus Repository or something similair.

Then we add into configuration section of maven-jira-plugin of pom.xml:

ru.matveev.alexey.tutorial.library jira-library

and into Import-Package section of maven-jira-plugin of pom.xml:


Then we change MyServlet.java class to this one:

package ru.matveev.alexey.tutorial.obr.servlet;

import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.matveev.alexey.tutorial.library.api.LibraryService;

import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class MyServlet extends HttpServlet{
private static final Logger log = LoggerFactory.getLogger(MyServlet.class);
private final LibraryService libraryService;

public MyServlet(@ComponentImport LibraryService libraryService) {
    this.libraryService = libraryService;

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
    resp.getWriter().write("<html><body>" + libraryService.getLibraryMessage() + "</body></html>");


That is all. We can launch jira with:


Jira will run on localhost:2990/jira. Login into Jira with admin:admin credentials and go to cog item → add-ons → manage add-ons. Then install obr file from the target folder of jira-obr plugin. After installation the manage add-ons section should look like this:

Then you can launch the servlet with:


And you will see the text message from our first plugin: