Web-Resources Not Loading Correctly

Hello All,

It seems when I am trying to load javascript resources for a custom context in my velocity templates, they are not getting loaded…

I am using #requireResourcesForContext("core5-resources")

The following is from my plugin.xml:

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}" />
        <param name="plugin-icon">images/pluginIcon.png</param>
        <param name="plugin-logo">images/pluginLogo.png</param>
    </plugin-info>

    <!-- add our i18n resource -->
    <resource type="i18n" name="i18n" location="core5"/>
    
    <!-- add our web resources -->
    <web-resource key="resources" name="core5 Web Resources">
        <dependency>com.atlassian.auiplugin:ajs</dependency>
        <dependency>com.atlassian.soy.soy-template-plugin:soy-deps</dependency>
        <dependency>confluence.web.resources:date-time-formatting</dependency>
        <dependency>com.atlassian.confluence.plugins.confluence-feature-discovery-plugin:confluence-feature-discovery-plugin-resources</dependency>
        <dependency>com.atlassian.confluence.plugins.confluence-link-browser:link-browser-resources</dependency>

        <resource type="download" name="core5.Form.js" location="/js/core5.Form.js"/>
        <resource type="download" name="core5.Group.js" location="/js/core5.Group.js"/>
        <resource type="download" name="core5.Layouts.js" location="/js/core5.Layouts.js"/>
        <resource type="download" name="core5.Fields.js" location="/js/core5.Fields.js"/>
        <resource type="download" name="core5.Column.js" location="/js/core5.Column.js"/>
        <resource type="download" name="core5.LinkBrowser.js" location="/js/core5.LinkBrowser.js"/>
        <resource type="download" name="images/" location="/images"/>

        <context>core5-resources</context>
    </web-resource>
    <web-resource key="general-resources" name="core5 Web Resources">
        <!-- transform Soy templates into JS -->
        <transformation extension="soy">
            <transformer key="soyTransformer">
                <functions>com.atlassian.confluence.plugins.soy:soy-core-functions</functions>
            </transformer>
        </transformation>

        <dependency>com.atlassian.auiplugin:ajs</dependency>
        <dependency>com.atlassian.soy.soy-template-plugin:soy-deps</dependency>
        <dependency>confluence.web.resources:date-time-formatting</dependency>
        <dependency>com.atlassian.confluence.plugins.confluence-feature-discovery-plugin:confluence-feature-discovery-plugin-resources</dependency>
        <dependency>com.atlassian.confluence.plugins.confluence-fixed-headers:handlers</dependency>
        <dependency>com.atlassian.confluence.plugins.confluence-fixed-headers:confluence-fixed-headers-view-content-resources</dependency>

        <resource type="download" name="core5v3.css" location="/css/core5v3.css"/>
        <resource type="download" name="core5v3.js" location="/js/core5v3.js"/>
        <resource type="download" name="core5.FeatureDiscovery.js" location="/js/core5.FeatureDiscovery.js"/>
        <resource type="download" name="js.cookie.js" location="/lib/jsCookie/js.cookie.js"/>
        <resource type="download" name="jquery.deserialize.js" location="/lib/jquery-deserialize/jquery.deserialize.js"/>
        <resource type="download" name="iventure-core5-feedback-soy.js" location="/soy/feedback.soy"/>
        <resource type="download" name="intro.js" location="/lib/introjs/intro.min.js"/>
        <resource type="download" name="intro.css" location="/lib/introjs/introjs.min.css"/>
        <resource type="download" name="iventure-convertPlatformKnowledge.js" location="/js/convertPlatformKnowledge.js"/>
        <resource type="download" name="iventure-convertPlatformKnowledge-soy.js" location="/soy/convertPlatformKnowledge.soy"/>
        <resource type="download" name="iventure-featureDiscovery-soy.js" location="/soy/featureDiscovery.soy"/>
        <resource type="download" name="images/" location="/images"/>
        <resource type="download" name="dataTables.checkboxes.css" location="/lib/datatablesCheckboxes/dataTables.checkboxes.css"/>
        <resource type="download" name="dataTables.checkboxes.js" location="/lib/datatablesCheckboxes/dataTables.checkboxes.min.js"/>


        <resource type="download" name="moxie.js" location="/lib/plupload/moxie.js"/>
        <resource type="download" name="plupload.dev.js" location="/lib/plupload/plupload.dev.js"/>
        <resource type="download" name="core5.UploadProgressDialog.js" location="/js/core5.UploadProgressDialog.js"/>
        <resource type="download" name="core5.Uploader.js" location="/js/core5.Uploader.js"/>
        <resource type="download" name="core5.UploadUtils.js" location="/js/core5.UploadUtils.js"/>
        <resource type="download" name="core5.Uploader.css" location="/css/core5.Uploader.css"/>

        <resource type="download" name="core5.Feedback.js" location="/js/core5.Feedback.js"/>

        <resource type="download" name="iventure-core5-uploader-soy.js" location="/soy/uploader.soy"/>
        <resource type="download" name="iventure-datatables-soy.js" location="/soy/datatables.soy"/>
        <resource type="download" name="iventure-space-sidebar-soy.js" location="/soy/spaceSidebar.soy"/>
        <resource type="download" name="flagArticleAsInaccurate.js" location="/js/flagArticleAsInaccurate.js"/>
        <resource type="download" name="flagger.js" location="/soy/flagger.soy"/>
        <context>atl.general</context>
        <context>atl.admin</context>
    </web-resource>

At first glance, this all looks correct. Maybe there is a conflict with your very generic resource key resources? Try to rename this one and see if it helps. What kind of code are you executing to verify that it’s not functioning correctly? You could try to add a very basic javascript which just uses alert to see if something happens. If not, try to load your resource via #requireResource("my-fancy-resource")and see if that loads the resource correctly.

Try including the resource by its distinct key:

#requireResource("${atlassian.plugin.key}:resources")

Build and re-deploy the plugin, then hard refresh the web page (clear the cache on reload, maybe hold shift key while clicking reload). In the web developer tools, network pane, you can confirm whether they are being loaded correctly.