I'm trying to upgrade my JIRA versions to latest-greatest as I inherited a system that is way behind. When running the upgrade in our test environment, I am getting some script failures that I found after the fact.
In our current JIRA, I see these errors when running the script registry:
- Script209.groovy:60 Public use of this method is deprecated - please use
ComponentAccessor instead. Since v5.2. @ line 60, column 39. - Script209.groovy:60 Get this component injected in your constructor or use
ComponentAccessor for static access instead. Since v5.2. @ line 60, column 39.
These are the lines in question:
def ProjectManager projectMgr = ComponentManager.getInstance().getProjectManager()
def IssueManager issueMgr = ComponentManager.getInstance().getIssueManager()
def IssueLinkManager linkMgr = ComponentManager.getInstance().getIssueLinkManager()
def CustomFieldManager custFldMgr = ComponentManager.getInstance().getCustomFieldManager()
def IssueFactory issueFactory = ComponentManager.getInstance().getIssueFactory()
For instance on ProjectManager, I tried changing it to the below but it gives an error after restarting JIRA.
def ProjectManager projectMgr = ComponentAccessor.getProjectManager()
Script78.groovy:60 [Static type checking] - Cannot find matching method com.atlassian.jira.ComponentManager#getProjectManager(). Please check if the declared type is right and if the method exists.
I'm new to groovy, etc... so I'm not sure how to continue with this.