Scriptrunner dev environment error

I have configured a dev environment as described here:

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] ------------------------------------------------------------------------
[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] 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] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]

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?

2 answers

I was able to reproduce this problem. I've filed a bug report, which we'll review as a dev team.

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. 



Hey @Jonny Carter, are there any updates? I run into the same issue and it seems like the workaround provided by @Michael Schlueter isn't working. Also, I'm not able to access the bug ticket - can you assist? 


@Michael Schlueter 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 Huschka. 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 "", then the path to the file should be

<your script root here>/com/my/package/Something.groovy.

Yes, that's exactly the file structure that I use. It works very well for me. Writing scripts is much easier now.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


251 views 0 6
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you