Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner Web Resource CSS not loading Edited

I have been following the docs to add some custom CSS (https://scriptrunner.adaptavist.com/latest/jira/fragments/WebResource.html).

On the "Install websource page", the Preview button returns:

<web-resource key='jira8-custom' name='ScriptRunner generated web item - jira8-custom'>
  <resource name='jira8-custom.css' type='download' location='jira8-custom.css' />
  <context>atl.general</context>
</web-resource>

which I believe implies that the jira8-custom.css file has been found in plugin.resource.directories.

When I refresh the Active Sprints page (where I expect to see the effect of the custom CSS) nothing has changed, and I cannot find any evidence of the rules in the browsers Web Developer Tools.

Have I missed something to get this working?

EDIT:

The following options are being passed in:

-Djira.home=/home/jira
-Dplugin.resource.directories=/home/jira/scriptrunner_scripts

 File is /home/jira/scriptrunner_scripts/jira8-custom.css and the jira user has read/write access.

A JIRA log suggests that the file cannot be found.

2019-11-11 13:27:26,832 http-nio-127.0.0.1-8080-exec-20 WARN anonymous 807x4991x2 10zvbih 172.18.58.203,127.0.0.1 /s/c105d797b025f536879b2e7e4f61c744-CDN/ca010b/805000/6411e0087192541a09d88223fb51a6a0/92ed8fb60806f456e655b19b4ab31a01/_/download/contextbatch/css/gh-rapid-work,gh-rapid-detailsview,jira.project.sidebar,atl.general,jira.global,com.atlassian.jira.projects.sidebar.init,greenhopper-rapid-non-gadget,jira.general,-_super/batch.css [webresource] error in `Content.writeTo` for com.onresolve.jira.groovy.groovyrunner:custom-css/jira8-custom.css
java.lang.RuntimeException: Cannot read resource jira8-custom.css
at com.atlassian.plugin.webresource.impl.snapshot.Resource$1.writeTo(Resource.java:204)

Installed version of Scriptrunner is 5.6.6.1-jira8, JIRA is V8.5.0

----------

Capture.PNG

2 answers

1 accepted

1 vote
Answer accepted

It turned out that the problem was that the resources directory /home/jira/scriptrunner_scripts had been created just after the JIRA service had been started.

2019-11-07 10:33:46,824 JIRA-Bootstrap WARN [c.a.p.util.resource.AlternativeDirectoryResourceLoader] Resource directory /home/jira/scriptrunner_scripts, which resolves to /home/jira/scriptrunner_scripts does not exist
Radek Janata Community Leader Mar 31, 2020

Thanks, this has helped me a lot (everything was correct, directory created, files in place, web resource well defined, preview showed correct output).

0 votes

Where is your jira8-custom.css file stored relative to the jira-home?

Also, those resources are cached by your browser, so after changes, you will need to clear the cache to reload the resource with the same key.

Alternatively, you can add a suffix to your key. I like to use a date like jira8-cusom.20191111. And after refreshing the file, you can just adjust the key to the current date to force your browser to re-download.

Thanks, the file is in a subdirectory of the JIRA home.  I haven't changed the file since uploading, so I don't think caching is the issue, and I have found logs that suggest it is not being found.  Any idea?

-Djira.home=/home/jira
-Dplugin.resource.directories=/home/jira/scriptrunner_scripts

 File is /home/jira/scriptrunner_scripts/jira8-custom.css

2019-11-11 13:27:26,832 http-nio-127.0.0.1-8080-exec-20 WARN anonymous 807x4991x2 10zvbih 172.18.58.203,127.0.0.1 /s/c105d797b025f536879b2e7e4f61c744-CDN/ca010b/805000/6411e0087192541a09d88223fb51a6a0/92ed8fb60806f456e655b19b4ab31a01/_/download/contextbatch/css/gh-rapid-work,gh-rapid-detailsview,jira.project.sidebar,atl.general,jira.global,com.atlassian.jira.projects.sidebar.init,greenhopper-rapid-non-gadget,jira.general,-_super/batch.css [webresource] error in `Content.writeTo` for com.onresolve.jira.groovy.groovyrunner:custom-css/jira8-custom.css
java.lang.RuntimeException: Cannot read resource jira8-custom.css
at com.atlassian.plugin.webresource.impl.snapshot.Resource$1.writeTo(Resource.java:204)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Bitbucket Smart Commits vs. Genius Commits - What's the difference?

If you already heard about Smart Commits in Bitbucket, know that you just stumbled upon something even better (and smarter!): Genius Commits by Better DevOps Automation for Jira Data Center (+ Server...

106 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you