I have a couple Groovy scripts that one of my co-workers and I run every week to collect some Jira ticket stats. I recently had to tweak the script some for the Groovy 3.0 update in the ScriptRunner for Jira version 7.0 update. That was fixed and things looked, well, groovy.
Today, our SR4J install was updated to 7.1.0. Now when either script is run from file, I get this error (mod the script name):
- /var/atlassian/application-data/jira/stats1.groovy:0 Expected class to be in package 'var.atlassian.application-data.jira' but found ''. This won't be supported in ScriptRunner 8.0. @ line 0, column 0.
If I take the contents of the file and paste it into Script Console under the Inline tab, the whole thing works fine with no warnings.
I'm relatively new to Groovy and my Java knowledge stops around version 1.1, but from what I can tell, if I want to run the stats1.groovy script from file, I need to have some Package declaration at the start of the file.
I tried:
Package var.atlassian.application-data.jira
at the top since the warning said that that's what it was expecting. That lead to the interpreter thinking that I was trying to subtract "data.jira" from "var.atlassian.application" and subsequent errors for "var" and "data" being undeclared, some other errors, and then the warning from above, but this time instead of finding an empty string, it found 'var.atlassian.application'.
Am I at least going down the right path here with using "Package"? I tried putting double and single quotation marks around the package name. I tried escaping the hyphen. Nothing worked. Is there some other way to tell the interpreter that '-' should be taken literally and not treated an an operator? Do I have to rearrange the container's directory structure to eliminate the warning?
Looking at https://groovy-lang.org/syntax.html#_identifiers, I see that in section 3.1 that the identifiers like 'a-d' are invalid, but then in section 3.2 they talk about quoted identifiers, but I'm not sure how (or if) they can be applied to the Package name.
Ideas?