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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.