I have configured a dev environment as described here: https://scriptrunner.adaptavist.com/5.1.8/jira/DevEnvironment.html
Everything works fine, except that if i place the sample groovy script "UsersCount.groovy" in the "<module>/src/main/resources" folder the atlas-debug command fails with an error:
[INFO] Generating a manifest for this plugin
[INFO] using maven-bundle-plugin v2.5.3
[WARNING] Manifest com.onresolve.scriptrunner.assets:sr-sample-plugin-jira:atlassian-plugin:1.0.4-SNAPSHOT : Unused Import-Package instructions: [org.springframework.osgi.*, org.eclipse.gemini.blueprint.*]
[ERROR] Manifest com.onresolve.scriptrunner.assets:sr-sample-plugin-jira:atlassian-plugin:1.0.4-SNAPSHOT : The default package '.' is not permitted by the Import-Package syntax.
This can be caused by compile errors in Eclipse because Eclipse creates
valid class files regardless of compile errors.
The following package(s) import from the default package null
[ERROR] Error(s) found in manifest configuration
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.198 s
[INFO] Finished at: 2017-10-12T22:17:45+01:00
[INFO] Final Memory: 60M/439M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.atlassian.maven.plugins:maven-jira-plugin:6.2.8:generate-manifest (default-generate-manifest) on project sr-sample-plugin-jira: Unable to execute mojo: Error(s) found in manifest configuration -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Content of the UsersCount.groovy:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager
def userManager = ComponentAccessor.getUserManager() as UserManager
def usersCount = userManager.getAllUsers().size()
return "My instance contains " + usersCount + " users"
Where should I place the script file instead? Is there another way to avoid this error?
Hey @Jonny Carter, are there any updates? I run into the same issue and it seems like the workaround provided by @Michael Schlueter _secunet_ isn't working. Also, I'm not able to access the bug ticket - can you assist?
@Michael Schlueter _secunet_ could you let me know how the structure of the folders looks like? So which folders you got in src and in ressources
Hey, @Felix. My bad on that issue--I linked to it, forgetting it wasn't public; I've updated my comment. That said, work on the instructions for setting up a development environment is underway and improvements should be in a future release (probably not the next one, but hopefully the one after).
I can probably help with the file structure bit as well.
Basically, for the package declaration to work, your folder structure has to match. So, if your file is named Something.groovy and the package is "com.my.package", then the path to the file should be
<your script root here>/com/my/package/Something.groovy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, that's exactly the file structure that I use. It works very well for me. Writing scripts is much easier now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was able to reproduce this problem. I've filed a bug report, which we'll review as a dev team.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jonny,
thank you for the answer; I will watch the bug report.
I've found out that it will work without a problem if I put the sample file in a package "com.example" and create the corresponding subfolder "com/example" in the resources folder.
Regards
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.