Can't seem to get web-resource for atl.general to load a JavaScript file?

I’m attempting to create a plugin that will load a JavaScript file in all JIRA, JIRA Software, and JIRA Service Desk pages.

I’ve followed instructions at https://developer.atlassian.com/jiradev/jira-platform/building-jira-add-ons/jira-plugins2-overview/jira-plugin-module-types/web-resource-plugin-module

I’ve added a web-resource like:

<web-resource name="Resources" key="resources">
    <resource name="resource.js" type="download" location="/js/resource.js"/>
    <context>atl.general</context>
</web-resource>

I install the plugin, but the JavaScript isn’t loaded anywhere. I’ve even added an alert() call just to see if it isn’t named the way I was expecting, but no alert boxes are opened.

I’m assuming I’m missing something pretty simple, but I can’t seem to find suggestions online that fix the problem.

Any thoughts or suggestions? Thanks!

Try removing the leading slash (‘/’) from the location. The JIRA doco says this (highlighting is mine):

"The location of a resource tells the plugin where the resource can be found in the jar file. (Resources are loaded by Java’s classpath resource loader.)

  • The full path to the file (without a leading slash) is required.
  • Must end in a ‘/’ when using the ‘namePattern’ attribute to load multiple resources in a directory."

Thanks for pointing me at the docs. I’ll verify the JAR is getting packaged the way I expect (that the file is in the appropriate path) and try without the leading slash.

Are there any errors in the logs? Make sure the javascript doesn’t have any syntax errors in it.

Thanks all for the tips, I was able to get it working.

Hi timothy.stavenger, You use how to it working. I’m having similar problem with jira version 7.