I looked into it and found that it can be done using
RemoteIssueLink link = new RemoteIssueLinkBuilder().issueId(issue.getId()).url("http://someUrl").summary("My web link").build(); ComponentAccessor.getComponent(RemoteIssueLinkManager.class).createRemoteIssueLink(link, user);
this code but as the createRemoteIssueLink is deprecated and I am using jira-api version 7 I am not sure how to do it?
I have found some other ways but I am getting the following exception
java.lang.IllegalStateException: ComponentAccessor has not been initialised.
This is not expected to occur on a production system.
Developers that encounter this message within a unit test
should use n MockitoMocksInContainer rule to initialize mockito and ComponentAccessor.
For more detailed explanation read the documentation
for MockComponentWorker in the jira-tests artifact for more information
about what causes this error and how to address it.
I have looked into the questions related to this exception but nothing helped.
So, the question is how to create remote links using java in the newer versions?