I wonder whether I can progmmatically add watchers to my Jira Issue through Java code instead of manually add it through web browser, for Jira 4.2 version? Is there an open source Jar for this purpose? Thanks.
You can develop your own plugins to add functionality to Jira. Refer to the Jira plugin development guide.
There are several tutorials available there. I have a simple tutorial avaiable here which you may also find helpful.
Maybe I did not explain clearly, I am not trying to make modification to my Jira server service, I am trying to automatically create issue and add watchers through another Java program which is not a part or plugin of the Jira server. I am trying to communicate with the Jira server through this other program, rather than through web browser. I guess to build a plugin is to change the Jira server itself and we do not want to do that. We just want to communicate with the server side through program. Sorry for the confusion. Do you have any suggestion towards what I am doing? thanks.
try with this code
WatcherManager watcherManager = ComponentManager.getInstance().getWatcherManager(); watcherManager.startWatching(user, issue.getGenericValue()); (or) private UserAssociationStore userAssociationStore = ComponentManager .getComponentInstanceOfType(UserAssociationStore.class); public static final String ASSOCIATION_TYPE = "WatchIssue"; userAssociationStore.createAssociation(ASSOCIATION_TYPE,user, issue.getGenericValue());
you can add watcher through REST api
check this doc
p.e using curl
curl -i -u admin:admin -H
-X POST -d
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 ...
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot