AJS/Jquery dependencies not downloaded with decorator atl.general

Hello guys,

I’m facing a pretty weird behavior with one of our server addon.
For some customers, our addon main velocity template which is set with decorator atl.general, does not have access to default AJS and jquery libraries. There are simply not downloaded at runtime.

I even tried to add the require resources in the template like this :

But still nothing.

As it is working for most, could any specific customization with standard velocity template be the root cause of that issue for some customers ? Any other thought to help me figure out what is happening ?

Thanks for your help,

Please use jira.webresources:jquery for depending on jQuery.
There is a good chance com.atlassian.auiplugin:ajs, com.atlassian.auiplugin:jquery
etc is deprecated/removed in latest AUI versions.
For example in this AUI upgrade guide I can see that

AUI considers jQuery and jQuery UI to be a deprecated implementation detail of its components and are not considered part of AUI’s public API.

it declares minimum required version of jQuery, but it doesn’t promise that it’ll bring in t’s own jQuery.

I recommend adding dependencies for the specific features/components you are using (for example com.atlassian.auiplugin:aui-dialog2)

Hi tjoy,

Thanks for your help.

I’m a little bit confused anyway. While specifying atl.general is the page meta decorator, I expect to be able to use AJS and jquery by default, this is not correct ?? Because this is working fine with all my instances;
The issue just happens for some customers. When I look on the browser network, only my internal addon libraries are downloaded, and nothing else. It looks like atl.general is not handled.

Any thought ? I don’t understand what is happening…

atl.general meta tag will likely just apply SiteMesh decorators like header/sidebar/footer etc.
Its purpose is just decoration, not loading scripts.

There is a bunch of things that happen to be loaded in every Jira page (like jQuery), but definitely not every page in Jira loads entire AUI components by default (That’ll be very bad for performance).

If your plugin creates it’s own page in Jira, you should declare proper <dependency> tags for your <web-resouece> to ensure they are loaded consistently in your page.

In this case my guess is that for some customers, they might have other plugins that is loading more resources into every Jira page (which is a bad practice), and your scripts happen to work by luck.

If your plugin is injecting scripts into existing page(s) in Jira (via atl.general web-resourcce <context>)
my guess is that in some Jira pages built in features/plugins are loading the resources your scripts need, so they work in those pages and break in the rest of pages.

So I recommend:

  • Use a more specific <web-resource> context than atl.general unless absolutely necessary, for example jira.view.issue
  • Declare proper <dependency> tags for your <web-resoueces> (like jQuery, aui-component1, aui-component-2 etc)

Ideally in your template/action you should be just doing requireResource(“my-plugins-main-resource”), and it loads all declared dependencies

1 Like

I appreciate your help, thank you.