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)
Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...
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