I am on JIRA 7.5.0 and JMWE 5.0.6.
I cannot import the Project Role Service class (I have also had the same issue with GroupRoleActorFactory.GroupRoleActor) when using JMWE, but when using the native JIRA groovy script runner, the exact same code that JMWE says does not work has no problem importing the classes I need.
Example script that causes the error when I paste it into JMWE (the first import statement):
import com.atlassian.jira.bc.projectroles.ProjectRoleService import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.security.roles.ProjectRoleActor import com.atlassian.jira.security.roles.ProjectRoleManager import com.atlassian.jira.util.SimpleErrorCollection def projectManager = ComponentAccessor.getProjectManager() def projectRoleService = ComponentAccessor.getComponent(ProjectRoleService) def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager) def errorCollection = new SimpleErrorCollection() def project = projectManager.getProjectObjByKey("PROJKEY") def projectRole = projectRoleManager.getProjectRole("Service Desk Customers") def actors = ['actor1Key', 'actor2Key'] projectRoleService.addActorsToProjectRole(actors, projectRole, project, ProjectRoleActor.USER_ROLE_ACTOR_TYPE, errorCollection)
Received an answer from JMWE support:
This is related to https://innovalog.atlassian.net/browse/JMWE-224 and is because JMWE does not support all packages in Groovy scripts.
Their suggested workaround, until the fix is released:
def projectRoleService = ComponentAccessor.getComponent(ComponentAccessor.getClassLoader().findClass("com.atlassian.jira.bc.projectroles.ProjectRoleService"))
Instead of using this:
def projectRoleService = ComponentAccessor.getComponent(ProjectRoleService)
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...
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
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs