Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

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 print 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 ( 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


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


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


Then we change 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;

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:









Thanks for the article! 

This is awesome! You should submit it as a topic over at so that the entire Development ecosystem can learn (or more importantly - it will become part of the resources available for developers).

Hi @Alexey Matveev _Appfire_ 

I downloaded your project (following your address and )

Change the config for <systemPath> then I try to run project
But somehow I got the error " The plugin cannot enable"
Screen Shot 2020-05-19 at 10.06.55.png


Try to enable it I got the log 

"Cannot determine required plugins, cannot resolve bundle 'ru.matveev.alexey.tutorial.obr.jira-obr'
2020-05-19 10:00:45,573 http-nio-2990-exec-10 INFO admin 600x234x1 ubp5d 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ru.matveev.alexey.tutorial.obr.jira-obr-key [c.a.plugin.util.WaitUntil] Plugins that have yet to be enabled: (1): [ru.matveev.alexey.tutorial.obr.jira-obr], 300 seconds remaining
2020-05-19 10:00:46,576 http-nio-2990-exec-10 INFO admin 600x234x1 ubp5d 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ru.matveev.alexey.tutorial.obr.jira-obr-key [c.a.plugin.util.WaitUntil] Plugins that have yet to be enabled: (1): [ru.matveev.alexey.tutorial.obr.jira-obr], 298 seconds remaining
2020-05-19 10:00:47,581 http-nio-2990-exec-10 INFO admin 600x234x1 ubp5d 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ru.matveev.alexey.tutorial.obr.jira-obr-key [c.a.plugin.util.WaitUntil] Plugins that have yet to be enabled: (1): [ru.matveev.alexey.tutorial.obr.jira-obr], 297 seconds remaining
2020-05-19 10:00:48,583 http-nio-2990-exec-10 INFO admin 600x234x1 ubp5d 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ru.matveev.alexey.tutorial.obr.jira-obr-key [c.a.plugin.util.WaitUntil] Plugins that have yet to be enabled: (1): [ru.matveev.alexey.tutorial.obr.jira-obr], 296 seconds remaining ....

2020-05-19 10:05:45,431 http-nio-2990-exec-10 INFO admin 600x234x1 ubp5d 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ru.matveev.alexey.tutorial.obr.jira-obr-key [c.a.plugin.util.WaitUntil] Plugins that have yet to be enabled: (1): [ru.matveev.alexey.tutorial.obr.jira-obr], 0 seconds remaining
2020-05-19 10:05:46,641 http-nio-2990-exec-10 INFO admin 600x234x1 ubp5d 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ru.matveev.alexey.tutorial.obr.jira-obr-key [c.a.plugin.manager.DefaultPluginManager] Disabling ru.matveev.alexey.tutorial.obr.jira-obr
2020-05-19 10:05:48,042 http-nio-2990-exec-10 DEBUG admin 600x234x1 ubp5d 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ru.matveev.alexey.tutorial.obr.jira-obr-key [c.a.activeobjects.osgi.ActiveObjectsServiceFactory] onPluginDisabledEvent removing delegate for [ru.matveev.alexey.tutorial.obr.jira-obr]
2020-05-19 10:05:48,078 http-nio-2990-exec-10 ERROR admin 600x234x1 ubp5d 0:0:0:0:0:0:0:1 /rest/plugins/1.0/ru.matveev.alexey.tutorial.obr.jira-obr-key [c.a.plugin.manager.PluginEnabler] Unable to start the following plugins due to timeout while waiting for plugin to enable: ru.matveev.alexey.tutorial.obr.jira-obr "

My atlas-version is: 
Screen Shot 2020-05-19 at 10.14.46.png

Do you have any advice? 
Looking for your response. Thank you in advance.

Tien Dang

@Dang Thi Thuy Tien 

Try to change this line in the pom.xml for jira-obr:

<Import-Package>ru.matveev.alexey.tutorial.library.api,org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", *</Import-Package> 


<Import-Package>ru.matveev.alexey.tutorial.library.api,org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", *;resolution:="optional"</Import-Package> 

and in jira-library

 <Import-Package> org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", * </Import-Package>


 <Import-Package> org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", *;resolution:="optional" </Import-Package>

Hi @Alexey Matveev _Appfire_ 

Thank for your quick response.
I change the config like your suggestion then clean and run for both projects again. But I got the same issue.

@Dang Thi Thuy Tien 

unzip the jira-obr file and make sure that you have the jira-library.jar in the dependencies folder in the jar file.

@Alexey Matveev _Appfire_  
I couldn't file any jira-library.jar inside the jira-obr-1.0.0-SNAPSHOT.jar after unzipping it
Screen Shot 2020-05-19 at 10.44.05.png

@Dang Thi Thuy Tien 

Sorry, Could you unpack the jira-obr.obr file? The extension of the file must be obr. If you can find the jira-library.jar inside, then go to Manage apps and upload the obr file.

Hi @Alexey Matveev _Appfire_ 
Yes, Inside the file.obr have the jira-library.jar. I try to upload file obr manually and plugin can run. Really great!

But, that means we have to upload the file manually?
Do you have any idea just using only the jar file. Can I push the jira-library.jar inside the jar file?

Thank you so much.

@Dang Thi Thuy Tien 

No, you can not add it to the jar file. 

What do you mean you should upload it manually? If you mean you need to upload it manually while developing an app, then you should upload it only once. Then you can package your plugin and your changes will be applied to your dev instance.

Hi, @Alexey Matveev _Appfire_ 

Yes, You are right. I should upload the obr file only once during the development. 

My goal is building a bridge like this

I have to create a couple of own dependencies. Then inject to the project (like your tutorial)
And we want to package it into 1 jar file. -> one plugin 

Do you have any advice for me? Sorry to make annoy you.

Thank you.

@Dang Thi Thuy Tien 

First of all you need to make sure that all your dependencies are bundles which can be understood by OSGI. If not you can do one of the following:

1. make your dependencies as OSGI bundles

2. upack your libraries in your jar file (make compile scope for these libraries in the pom.xml)

3. add to META-INF/lib folder

Hi, @Alexey Matveev _Appfire_  

I try to follow your suggestion:

1. Change the <packaging> in lib to jar.


 2. Copy the lib.jar file in local repository
 3. Change the dependency <scope> 


4. Copy the lib.jar file into META-INF/lib folder

-> I got the same issue :( 

@Dang Thi Thuy Tien You should delete 

<pluginDependencies> <pluginDependency> <groupId>ru.matveev.alexey.tutorial.library</groupId> <artifactId>jira-library</artifactId> </pluginDependency> </pluginDependencies>

form the pom.xml

Hi, @Alexey Matveev _Appfire_ 
Yes, I did. But it got the same issue
I try to change the <Export-package> in jira-obr project like this:


 It works for me.

Thank you so much


Log in or Sign up to comment

Atlassian Community Events