Not able to create custom issue type from plugin

I am trying to create custom issue type from my plugin, but have been unsuccessful so far. I have followed example outlined here, but when I do -atlas-run I get error that IssueTypeManager is not instantiable. I am completly blockedon my plugin development due to this as this is the first thing that needs to happen by the design, so your help is very much appreciated. If you need any more info than this please let me know. The code is exactly like this:

package com.myjiraplugins;
import com.atlassian.jira.config.IssueTypeManager;
import com.atlassian.jira.util.JiraUtils;
import com.atlassian.sal.api.ApplicationProperties;

public class MyPluginComponentImpl implements MyPluginComponent {
private final ApplicationProperties applicationProperties;

public MyPluginComponentImpl(ApplicationProperties applicationProperties) { this.applicationProperties = applicationProperties;

IssueTypeManager itm = (IssueTypeManager) JiraUtils.loadComponent(IssueTypeManager.class); itm.createIssueType("mytype", "custom issue type", "/images/icons/issuetypes/genericissue.png");
}
public String getName() { if(null != applicationProperties) {

return "myComponent:" + applicationProperties.getDisplayName();
}
return "myComponent";
}
}

3 answers

Hi,

Can you try to use for example:

ComponentAccessor.getComponent(IssueTypeManager.class)

or

ComponentAccessor.getComponentOfType(IssueTypeManager.class)

instead of using the Jirautils to load the class?

BR
Christoffer

If we are talking about the same things, it's also explained here:

https://developer.atlassian.com/pages/viewpage.action?pageId=4227139

/Christoffer

Thank you Christoffer. It helped me, I was able to create custom type. Though, I was getting error that ComponentAccessor is not initialized, even after Ihave made object of it and assigned null value to it. So, I have disabled unit test and everything was fine then. Thanks again.

Hi,

I don't think you should try to initiate the ComponentAccessor. You can use it directly like this:

IssueTypeManager itm = ComponentAccessor.getComponent(IssueTypeManager.class);

But prefered way of doing it is to simply specify in the constructor that you will need this object:

public MyPluginComponentImpl(ApplicationProperties applicationProperties, IssueTypeManager itm) { this.applicationProperties = applicationProperties;

Feel free to mark any of my answers as best answers to mark this question as solved if it helped you with your problems :)

BR

Christoffer

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,089 views 13 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot