I am trying to pass enum to function, but it stil raises errors:
import com.atlassian.jira.component.ComponentAccessor def plugin = ComponentAccessor.getPluginAccessor().getPlugin('com.almworks.jira.structure') // Get structure with ID 119 def syncManager = plugin.getModuleDescriptor('sync-manager').getModule() syncManager.resync(114, SyncDirection.INBOUND, false)
I mean SyncDirection.INBOUND here, API where I found it is available here: http://almworks.com/structure/javadoc/latest/com/almworks/jira/structure/api/sync/SyncDirection.html
It still raises me:
groovy.lang.MissingPropertyException: No such property: SyncDirection for class: Script1 at Script1.run(Script1.groovy:6)
Yes, you will need the import, and @WithPlugin (https://scriptrunner.adaptavist.com/latest/jira/scripting-other-plugins.html#__withplugin) so the classloader can find it. I think it would be better to use @PluginModule (same page) rather than your method.
I tried it too, also with @WithPlugin it raises:
unable to resolve class com.almworks.jira.structure.api.sync.SyncDirection
import com.atlassian.jira.component.ComponentAccessor import com.onresolve.scriptrunner.runner.customisers.WithPlugin import com.almworks.jira.structure.api.sync.SyncDirection //blah blah blah
also when I use just import com.almworks.jira.structure.
Did you put the right param for WithPlugin? See https://scriptrunner.adaptavist.com/latest/jira/scripting-other-plugins.html#_example. Please paste the full script that doesn't work, the blah blah is the important bit.
import com.atlassian.jira.component.ComponentAccessor import com.onresolve.scriptrunner.runner.customisers.PluginModule import com.onresolve.scriptrunner.runner.customisers.WithPlugin import com.almworks.jira.structure.api.sync import com.almworks.jira.structure.api.sync.SyncDirection @WithPlugin("com.almworks.jira.structure") @PluginModule StructureSyncManager syncManager syncManager.resync(114, SyncDirection.INBOUND, false)
I'd like to run one direction sync.
It's missing imports, this works for me:
import com.atlassian.jira.component.ComponentAccessor import com.onresolve.scriptrunner.runner.customisers.PluginModule import com.onresolve.scriptrunner.runner.customisers.WithPlugin import com.almworks.jira.structure.api.sync.SyncDirection import com.almworks.jira.structure.api.sync.StructureSyncManager @WithPlugin("com.almworks.jira.structure") @PluginModule StructureSyncManager syncManager syncManager.resync(114L, SyncDirection.INBOUND, false)
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Atlas Camp is our developer event which will take place in Barcelona, Spain from the 6th -7th of September . This is a great opportunity to meet other developers and get n...
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