Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to properly use @JiraImport annotation

mandalorian
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 1, 2021

Hello,

I tried to follow this tutorial here: 

https://developer.atlassian.com/server/jira/platform/creating-a-jira-issue-crud-servlet-and-issue-search/

 

I have following service class:

@Scanned
@Service
public class JiraService {
private static final Logger log = LoggerFactory.getLogger(JiraService.class);

@JiraImport
private IssueService issueService;

@JiraImport
private ProjectService projectService;

@JiraImport
private UserManager userManager;

@JiraImport
private ConstantsManager constantsManager;

@JiraImport
private JiraAuthenticationContext authenticationContext;

public JiraService(IssueService issueService, ProjectService projectService, UserManager userManager, ConstantsManager constantsManager, JiraAuthenticationContext authenticationContext) {
this.issueService = issueService;
this.projectService = projectService;
this.userManager = userManager;
this.constantsManager = constantsManager;
this.authenticationContext = authenticationContext;
}


 

Wiring it in another service:

@Autowired
@Inject
private JiraService jiraService; 

 

But jira locally does not start at all as it enters some magical cycle while trying to run locally by atlas-run cmd:

[INFO] [talledLocalContainer] "Reference Handler" Id=2 RUNNABLE
[INFO] [talledLocalContainer] at java.base@14.0.2/java.lang.ref.Reference.waitForReferencePendingList(Native Method)
[INFO] [talledLocalContainer] at java.base@14.0.2/java.lang.ref.Reference.processPendingReferences(Reference.java:241)
[INFO] [talledLocalContainer] at java.base@14.0.2/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:213)
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] "Finalizer" Id=3 WAITING on java.lang.ref.ReferenceQueue$Lock@8b885ce
[INFO] [talledLocalContainer] at java.base@14.0.2/java.lang.Object.wait(Native Method)
[INFO] [talledLocalContainer] - waiting on java.lang.ref.ReferenceQueue$Lock@8b885ce
[INFO] [talledLocalContainer] at java.base@14.0.2/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155)
[INFO] [talledLocalContainer] at java.base@14.0.2/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:176)
[INFO] [talledLocalContainer] at java.base@14.0.2/java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:170)
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] "Signal Dispatcher" Id=4 RUNNABLE

 

In my humble opinion there is an issue combining constructor and JiraImport annotations..

 

1 answer

0 votes
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 2, 2021

Hey @mandalorian , welcome!

I see this question has already gone a day without an answer, which generally decreases the likelihood that it will get answered here. Most of the folks answering questions are end-users and admins, rather than developers working directly with atlas-run.

We have a dedicated Developer Community that might be good to check out for plugin development related questions. Since the topics are more focused, it's easier for other developers to watch the questions coming in and provide guidance. I would recommend posting there as it's likelier that the question will be seen by other Java developers working in the Jira SDK.

Cheers,
Daniel

Suggest an answer

Log in or Sign up to answer