Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner Web Resource CSS not loading

mjp4 November 11, 2019

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
mjp4 November 12, 2019

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
Contributor
March 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
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2019

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.

mjp4 November 12, 2019

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
AUG Leaders

Atlassian Community Events