This is one of those problems that make an otherwise intellgent person feel kinda dumb...like I half-anticipate Jamie will come on here with a simple answer and i'll slap my forehead but here we go:
I've gotten pretty good at listeners but taking my first crack at postfunction "canned" script and got some serious head-scratching going on here. First,
the script examples includes a helpful object "com.onresolve.jira.groovy.canned.utils.WorkflowUtils" to pull out params like this:
WorkflowUtils.getUser(params)
Unfortunately, adding the groovyrunner-2.1.15.jar to my <jira>\atlassian-jira\WEB-INF\lib and my IDEA class library does not resolve anything in the "utils" namespace? Even though those classes are clearly there and clearly in the library list in IDEA. See the short clip for proof I'm not crazy. ;)
http://screencast.com/t/3yvGe8GMC
Additional bonus question: I've had to grab the latest groovyrunner-n.n.n.jar out of my plugins directories because I can only find incidental references to that jar file online and they're all out-of-date. Is there a standard location to download the class libraries? (and source jar would be awesome too)
Sorry... don't think there is a super simple answer. I think the problem is that many classes, eg that one, is not in the jar as a .class, it's in there as source.
When scripts get loaded the first time then all the dependent stuff is compiled (inside of jira). This is partly due to the mechanics of the groovy compilation process - when it's compiled for 6.0, it might well be incompatible with 6.0.1 if an additional constructor is added to some jira class that my class extends.
In the next major version they will also be shipped compiled, which helps a little with startup time.
I think you should be able to add the jar to the sources category, probably as well as the classes category, then IDEA should resolve it.
> Additional bonus question: I've had to grab the latest groovyrunner-n.n.n.jar out of
Don't really understand this one, you just get it from marketplace...?
> and source jar would be awesome too
As mentioned most of the stuff you want is in the "binary" jar as source... source for everything is not currently available.
Library should appear something like this:
Hi Jamie - wow, that was fast! Thank you.
I think I was anticipating a separate "SDK" jar location or something. I just get it from the version history! Makes sense.
So follow-on: Is it required then to extend a concrete class when implementing a post-function script? The reason I ask is that it writes to the log when I say, remove a method that is required when implementing the CannedScript interface, but when all methods are there, it fails silently.
Here's my class def:
class CreateMaintenanceIssueScript implements CannedScript {
...
then (for simplicity's sake) my doScript:
Map doScript(Map<String,Object> params) {
Logger log = Logger.getLogger(CreateMaintenanceIssueScript.class)
log.info("Begin Create Maintenance Request Script.")
return params
}
Prints nothing at all.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Steve... for a post-function you just want a plain old groovy script. They are simpler than listeners.
Implement CannedScript when you want another built-in script, ie one that can be parameterised and reused... But the internals of it are not well documented or exposed to end users.
Don't you just want a plain old script here, which you point to in your post-function...?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
its hard to tell what runtime objects the scripts will have access to so I simply did a "view source" on your clone script and extrapolated from there. Turns out, with some requirements changes, we were able to use your (awesome) clone script as-is but, for future understanding, is there exhaustive doc on runtime script object references somewhere? The link seems to elude me. :S many thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.