Missed Team ’24? Catch up on announcements here.

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

Script import breaks JIRAs navigation bar

Jeff Morgan August 21, 2016

Hey Guys,

I use

<link rel="stylesheet" href="//aui-cdn.atlassian.com/aui-adg/5.10.1/css/aui.min.css" media="all">
<link rel="stylesheet" href="//aui-cdn.atlassian.com/aui-adg/5.10.1/css/aui-experimental.min.css" media="all">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//aui-cdn.atlassian.com/aui-adg/5.10.1/js/aui.min.js"></script>
<script src="//aui-cdn.atlassian.com/aui-adg/5.10.1/js/aui-experimental.min.js"></script>

to get my AUI items working.

But this way seems to break JIRAs navigation bar. The dropdowns don't work anymore and the cosole logs

batch.js:21982 Uncaught Error: Dropdown 2 trigger required attribute not set: aria-owns

Without these lines the navigation works but the AUI does not.

How do I fix this?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Volodymyr Krupach
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.
August 25, 2016

Hi Jeff,

As I understand you are developing server addon and for the server addon you should NOT include external AUI CSS and JavaScripts from the CDN.

Instead you should rely on AUI from the host application. There are 2 ways:

1) you directly refer resources in velocity through $webResourceManager.requireResourcesForContext("STH CONTEXT") or $webResourceManager.requireResource("RESOURCE_KEY"). The key you can get from appropriate AUI page. For example restfull table:

$webResourceManager.requireResource("com.atlassian.auiplugin:aui-experimental-restfultable")

2) add resources as dependencies to your web-resource tag. In this case you need to make sure that your web-resource is injected either through requireResourcesForContext or by providing context. For example here context is atl.general which means all pages except admin area:

<web-resource key="some-key" name="some-name">
    <dependency>com.atlassian.auiplugin:aui-experimental-restfultable</dependency>
 
    <resource type="download" name="your.css" location="/css/your.css" />
    <resource type="download" name="your.js" location="/js/your.js" />
    <resource type="download" name="images/" location="/images" />
 
    <context>atl.general</context>
</web-resource>


 

Jeff Morgan August 25, 2016

Hi Volodymyr,

I am aware of that, but it was the only way I got it to run (This here was my origin).

Where do I find the CDN includes I got from here? I also downloaded them to my ressouces folder and includes them as resource element to the web-resource tag but I did not work.

 

This is the current state:

<web-resource key="todo_plugin-resources" name="todo_plugin Web Resources">
        <context>todo_plugin</context>
        <dependency>com.atlassian.auiplugin:ajs</dependency>
        <dependency>com.atlassian.auiplugin:dialog2</dependency>
        <dependency>com.atlassian.auiplugin:aui-table-sortable</dependency>
        <dependency>com.atlassian.auiplugin:aui-experimental-iconfont
        </dependency>
        <resource type="download" name="todo_plugin.css" location="/css/todo_plugin.css" />
        <resource type="download" name="dialog2.js" location="/js/dialog2.js" />
        <resource type="download" name="images/" location="/images" />
    </web-resource>
<head>
<title>Todos</title>
<link rel="stylesheet"
    href="//aui-cdn.atlassian.com/aui-adg/5.10.1/css/aui.min.css"
    media="all">
<link rel="stylesheet"
    href="//aui-cdn.atlassian.com/aui-adg/5.10.1/css/aui-experimental.min.css"
    media="all">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//aui-cdn.atlassian.com/aui-adg/5.10.1/js/aui.min.js"></script>
<script
    src="//aui-cdn.atlassian.com/aui-adg/5.10.1/js/aui-experimental.min.js"></script>
<meta name="decorator" content="atl.general">
$webResourceManager.requireResource("com.example.todo_plugin:todo_plugin-resources")
</head>
Volodymyr Krupach
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.
August 25, 2016

Hi Jeff,

You do NOT need CDN's for the server addon. These are for cloud addons. Please remove CDN links and scrips from the vm.

I do not see any problems in atlassian-plugin.xml and vm files. Do you retrieve any errors during plugin start? Atlassian frameworks batches referred JS and CSS files and batching fails if there any syntax errors in JS files. This results in absence of resources. Try to add "alert('Hi')" in dialog2.js and check if it appears.

One more case could be that you are developing for/under JIRA prior to 6.2 that misses Dialog2 that you include. Dialog2 is available starting from AUI 5.3 and AUI 5.3 and higher are available since JIRA 6.2. See the compatibility matrix.

Also check that "com.example.todo_plugin" matches the addon key that you have in atlassian-plugin tag.

Jeff Morgan August 25, 2016

OK, so I removed the links, now the AUI scripts aren't working anymore.

modal2 prints e.g.

batch.js?atlassian.aui.raphael.disabled=true&locale=en-US:10152 
Failed to run init function: TypeError: AJS.dialog2 is not a function
function ($) {     
    // Shows the dialog when the "Show dialog" button is clicked
    AJS.$("#dialog-show-button").click(function() {
        AJS.dialog2("#demo-dialog").show();
    });
    // Hides the dialog
    AJS.$("#dialog-close-button").click(function(e) {
        e.preventDefault();
        AJS.dialog2("#demo-dialog").hide();
    });
    // Show event - this is triggered when the dialog is shown
    AJS.dialog2("#demo-dialog").on("show", function() {
        console.log("demo-dialog was shown");
    });
    // Hide event - this is triggered when the dialog is hidden
    AJS.dialog2("#demo-dialog").on("hide", function() {
        console.log("demo-dialog was hidden");
    });
    // Global show event - this is triggered when any dialog is show
    AJS.dialog2.on("show", function() {
        console.log("a dialog was shown");
    });
    // Global hide event - this is triggered when any dialog is hidden
    AJS.dialog2.on("hide", function() {
        console.log("a dialog was hidden");
    });
}

when I refresh the page. If I click on the modal opening button it prints

com.atlassian.auiplugin:dialog2.js?locale=en-US:8 
Uncaught TypeError: AJS.dialog2 is not a function

Weird thing is the dialog2.js looks likes this aufter your advice

AJS.toInit(function($) { 
    
    alert('Hi');
    
    // Shows the dialog when the "Show dialog" button is clicked
    AJS.$("#dialog-show-button").click(function() {
        AJS.dialog2("#demo-dialog").show();
    });
    // Hides the dialog
    AJS.$("#dialog-close-button").click(function(e) {
        e.preventDefault();
        AJS.dialog2("#demo-dialog").hide();
    });
    // Show event - this is triggered when the dialog is shown
    AJS.dialog2("#demo-dialog").on("show", function() {
        console.log("demo-dialog was shown");
    });
    // Hide event - this is triggered when the dialog is hidden
    AJS.dialog2("#demo-dialog").on("hide", function() {
        console.log("demo-dialog was hidden");
    });
    // Global show event - this is triggered when any dialog is show
    AJS.dialog2.on("show", function() {
        console.log("a dialog was shown");
    });
    // Global hide event - this is triggered when any dialog is hidden
    AJS.dialog2.on("hide", function() {
        console.log("a dialog was hidden");
    });
});

Not only after atlas-package but after atlas-clean and atlas-run (??)

I am running JIRA 7.1.4 and the atlassian.plugin.key(s) are matching.

Volodymyr Krupach
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.
August 25, 2016

So do you get "Hi" when the page is loaded? If no and there is "AJS.dialog2 is not a function" error in the console it means that you try to refer dialog2 before the actual dialog2 script is loaded. All your code should start in AJS.toInit block.

Also please remove "//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js". JIRA already has jquery and safe way to access it is "AJS.$".

Jeff Morgan August 26, 2016

No, i don't get "Hi" printed, please take a look at the dialog2 error - the alert('Hi') seems to doesn't even appear in the code despite server restart.

And as you can see the dialog2.js starts with AJS.toInit(function($) {...

The atlassian-plugin.xml web resource I posted here is the current one, there is no external jquery anymore sinceI removed the link and script tags from the *.vm file.

 

Volodymyr Krupach
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.
August 26, 2016

Lets start commenting stuff to find the problem. Simplify atlassian-plugin.xml:

<web-resource key="todo_plugin-resources" name="todo_plugin Web Resources">
    <dependency>com.atlassian.auiplugin:ajs</dependency>
    <dependency>com.atlassian.auiplugin:dialog2</dependency>
	<!-- reanme js to test.js just to be safe -->
    <resource type="download" name="test.js" location="/js/test.js" />

</web-resource>
test.js:
AJS.toInit(function($) {
  alert('Hi');
});

vm file:

<html>
<head>
  <title>Todos</title>
  <meta name="decorator" content="atl.general">
$webResourceManager.requireResource("com.example.todo_plugin:todo_plugin-resources")
</head>
<body>
  Do you get Hi?
</body>
</html>

Let me know if it says "Hi".

Jeff Morgan August 26, 2016

It does not, although the code(web-resource / vm-file / js-file) looks exaclty like you said.

Plus it's still printing the dialog2 function:

js error.JPG

but not the one in the current dialog2js, the current one still contains the alert on top.

I will try it again with a cleaned and restarted server.

 

Edit:

There is no use to clean and restart the server. The logs are the same.

Volodymyr Krupach
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.
August 26, 2016

It did not reload the script. Make sure that you have:

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

and test.js under js folder. run To be sure run "atlas-clean".

Jeff Morgan August 29, 2016

Hey Volodymyr,

I don't understand the way JIRA loads/chaches JavaScript. The quickreloader doesn't care about my JavaScript - I could remove everything but it would still execute the js it loaded before. E.g. I have the todos vm file like you said, in my atlassian-plugin.xml I have this

&lt;web-resource key="todo_plugin-resources" name="todo_plugin Web Resources"&gt;
        &lt;context&gt;todo_plugin&lt;/context&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:ajs&lt;/dependency&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:dialog2&lt;/dependency&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:aui-table-sortable&lt;/dependency&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:aui-experimental-iconfont&lt;/dependency&gt;
&lt;!--         &lt;resource type="download" name="todo_plugin.css" location="/css/todo_plugin.css" /&gt; --&gt;
&lt;!--         &lt;resource type="download" name="dialog2.js" location="/js/dialog2.js" /&gt; --&gt;
&lt;!--         &lt;resource type="download" name="images/" location="/images" /&gt; --&gt;
        &lt;resource type="download" name="test.js" location="/js/test.js" /&gt;
    &lt;/web-resource&gt;

and in my test.js under resources/js/test.js this:

AJS.toInit(function($) {
  alert('Hi from test.js');
});

now on the todos page i get get nothing - on another page I where I ´have the same resource required I only got "Hi" three time, but from the dialog2.js now. But there is no alert("Hi") function call anymore. I shut down the server, removed it, used atlas-clean and reran it, how is this possible??

On this other page I also get this:

batch.js?atlassian.aui.raphael.disabled=true&amp;locale=de-DE:10152 Failed to run init function: TypeError: AJS.dialog2 is not a function
function ($) { 
    
    alert('Hi');
    
    // Shows the dialog when the "Show dialog" button is clicked
    AJS.$("#dialog-show-button").click(function() {
        AJS.dialog2("#demo-dialog").show();
    });
    // Hides the dialog
    AJS.$("#dialog-close-button").click(function(e) {
        e.preventDefault();
        AJS.dialog2("#demo-dialog").hide();
    });
    // Show event - this is triggered when the dialog is shown
    AJS.dialog2("#demo-dialog").on("show", function() {
        console.log("demo-dialog was shown");
    });
    // Hide event - this is triggered when the dialog is hidden
    AJS.dialog2("#demo-dialog").on("hide", function() {
        console.log("demo-dialog was hidden");
    });
    // Global show event - this is triggered when any dialog is show
    AJS.dialog2.on("show", function() {
        console.log("a dialog was shown");
    });
    // Global hide event - this is triggered when any dialog is hidden
    AJS.dialog2.on("hide", function() {
        console.log("a dialog was hidden");
    });
}
Volodymyr Krupach
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.
August 29, 2016

Maybe you have other web-resource tag that pushes /js/dialog2.js.

Jeff Morgan August 29, 2016

todo_plugin-resources is my only web-resources tag, I just don't get it and from your reaction I can tell this is anything but normal behavior?

Volodymyr Krupach
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.
August 29, 2016

This is mystery smile. Send me the zip with your addon and I will look into it. Probably tomorrow afternoon. 

Jeff Morgan August 29, 2016

Hey Volodymyr,

I just solved the mystery. The alert wasn't gone after cleaning because it wasn't the cache of JIRA but of Chrome!

Wiping Chromes cache removes such problems. Only the right alerts are printed now and the test.js works on every page. Nevertheless Uncaught TypeError: AJS.dialog2 is not a function gets logged.

I unraveled it a bit, so now I have

&lt;web-resource key="general-resources"&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:ajs&lt;/dependency&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:aui-experimental-iconfont&lt;/dependency&gt;
        &lt;resource type="download" name="test.js" location="/js/test.js" /&gt;
    &lt;/web-resource&gt;
    &lt;web-resource key="dialog-resources"&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:dialog2&lt;/dependency&gt;
        &lt;resource type="download" name="dialog2.js" location="/js/dialog2.js" /&gt;
    &lt;/web-resource&gt;
    &lt;web-resource key="table-resources"&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:aui-table-sortable&lt;/dependency&gt;
        &lt;resource type="download" name="tableSortable.js" location="/js/tableSortable.js" /&gt;
    &lt;/web-resource&gt;

and

$webResourceManager.requireResource("com.example.todo_plugin:general-resources")
$webResourceManager.requireResource("com.example.todo_plugin:dialog-resources")
$webResourceManager.requireResource("com.example.todo_plugin:table-resources")
Volodymyr Krupach
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.
August 30, 2016

Hi Jeff,

Lets do it step by step. Please add the dialog dependency to general-resources and change alert("Hi") to alert(AJS.dialog2):

&lt;web-resource key="general-resources"&gt;
&lt;dependency&gt;com.atlassian.auiplugin:ajs&lt;/dependency&gt;
&lt;dependency&gt;com.atlassian.auiplugin:aui-experimental-iconfont&lt;/dependency
&lt;dependency&gt;com.atlassian.auiplugin:dialog2&lt;/dependency&gt;
&lt;resource type="download" name="test.js" location="/js/test.js" /&gt;
&lt;/web-resource&gt;

// changes in test.js:
alert(AJS.dialog2);

And make sure to clear chrome cache.

Jeff Morgan August 30, 2016

It prints undefined .

Volodymyr Krupach
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.
August 30, 2016

Searched for dialog2 dependency through the addons that we developed and I see it in at least 3 addons and I am sure they work.

Later will extract working "hello dialog2" for you.

Jeff Morgan August 30, 2016

Is it possible I broke something im the pom? Or I that I'm using a wrong version of something?

BTW this the AJS object in the console:

Volodymyr Krupach
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.
August 30, 2016

Hi Jeff,

I have created the empty project with dialog2 dependency and it works as expected. Here is the archive: . I guess something wrong with your project but I have no idea what it can be. Actually we tried all things that make sense so it looked as some mystery for me.

The alert(AJS.dialog2) looks like:

image2016-8-30 23:20:8.png

Volodymyr Krupach
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.
August 30, 2016

One more thing that can cause "JS caching". Maybe resources batching is on. Please check this thread: https://answers.atlassian.com/questions/40349345.

Jeff Morgan August 31, 2016

Hey Volodymyr,

your code works for me too and the only thing that is really different is indeed the pom.xml.

I cut my code to the absolut minimum - so nothing but the pom.xml, atlassian-plugin.xml and the js files exist. Would you mind looking at my pom file? It's a mess where I added everything I seemed to need in order to to let something work...

Volodymyr Krupach
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.
August 31, 2016

Hi Jeff,

From the first sight I do not see any problem in the pom.xml and actually pom.xml should not create any problems with web-resource tags.

Why do not you take the clean pom and start building from it. You can take mine version or clear yours. Required pom dependencies for spring-scanner approach are: jira-api, atlassian-spring-scanner-annotation, atlassian-spring-scanner-runtime and javax.inject.

Jeff Morgan August 31, 2016

This is so damn frustrating.... you are right it wasn't the pom - I rebuild it with nothing but the spring scanner and it's still undefined, but what else could it be since there isn't really much left to be wrong?!?

&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.example&lt;/groupId&gt;
    &lt;artifactId&gt;todo_plugin&lt;/artifactId&gt;
    &lt;version&gt;0.1.0&lt;/version&gt;
    &lt;organization&gt;
        &lt;name&gt;Awesomeness Inc&lt;/name&gt;
        &lt;url&gt;http://www.awesomebreedsmoarawesome.com/&lt;/url&gt;
    &lt;/organization&gt;
    &lt;name&gt;TODO PLUGIN&lt;/name&gt;
    &lt;description&gt;plugin for Atlassian JIRA.&lt;/description&gt;
    &lt;packaging&gt;atlassian-plugin&lt;/packaging&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;com.atlassian.jira&lt;/groupId&gt;
            &lt;artifactId&gt;jira-api&lt;/artifactId&gt;
            &lt;version&gt;${jira.version}&lt;/version&gt;
            &lt;scope&gt;provided&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;!-- DEPS FOR SPRING SCANNER --&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;com.atlassian.plugin&lt;/groupId&gt;
            &lt;artifactId&gt;atlassian-spring-scanner-annotation&lt;/artifactId&gt;
            &lt;version&gt;${atlassian.spring.scanner.version}&lt;/version&gt;
            &lt;scope&gt;compile&lt;/scope&gt;
        &lt;/dependency&gt;

        &lt;dependency&gt;
            &lt;groupId&gt;com.atlassian.plugin&lt;/groupId&gt;
            &lt;artifactId&gt;atlassian-spring-scanner-runtime&lt;/artifactId&gt;
            &lt;version&gt;${atlassian.spring.scanner.version}&lt;/version&gt;
            &lt;scope&gt;runtime&lt;/scope&gt;
        &lt;/dependency&gt;

        &lt;dependency&gt;
            &lt;groupId&gt;javax.inject&lt;/groupId&gt;
            &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
            &lt;version&gt;1&lt;/version&gt;
            &lt;scope&gt;provided&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;!-- /DEPS FOR SPRING SCANNER --&gt;
    &lt;/dependencies&gt;
    &lt;build&gt;
        &lt;plugins&gt;
            &lt;plugin&gt;
                &lt;groupId&gt;com.atlassian.maven.plugins&lt;/groupId&gt;
                &lt;artifactId&gt;maven-jira-plugin&lt;/artifactId&gt;
                &lt;version&gt;${amps.version}&lt;/version&gt;
                &lt;extensions&gt;true&lt;/extensions&gt;
                &lt;configuration&gt;
                    &lt;productVersion&gt;${jira.version}&lt;/productVersion&gt;
                    &lt;productDataVersion&gt;${jira.version}&lt;/productDataVersion&gt;
                    &lt;enableQuickReload&gt;true&lt;/enableQuickReload&gt;
                    &lt;enableFastdev&gt;false&lt;/enableFastdev&gt;

                    &lt;applications&gt;
                        &lt;application&gt;
                            &lt;applicationKey&gt;jira-software&lt;/applicationKey&gt;
                            &lt;version&gt;${jira.software.application.version}&lt;/version&gt;
                        &lt;/application&gt;
                        &lt;application&gt;
                            &lt;applicationKey&gt;jira-servicedesk&lt;/applicationKey&gt;
                            &lt;version&gt;${jira.servicedesk.application.version}&lt;/version&gt;
                        &lt;/application&gt;
                    &lt;/applications&gt;

                    &lt;!-- See here for an explanation of default instructions: --&gt;
                    &lt;!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins --&gt;
                    &lt;instructions&gt;
                        &lt;Atlassian-Plugin-Key&gt;${atlassian.plugin.key}&lt;/Atlassian-Plugin-Key&gt;

                        &lt;!-- Add package import here --&gt;
                        &lt;Import-Package&gt;
                            org.springframework.osgi.*;resolution:="optional",
                            org.eclipse.gemini.blueprint.*;resolution:="optional",
                            *
                        &lt;/Import-Package&gt;

                        &lt;!-- Ensure plugin is spring powered --&gt;
                        &lt;Spring-Context&gt;*&lt;/Spring-Context&gt;
                    &lt;/instructions&gt;

                &lt;/configuration&gt;
            &lt;/plugin&gt;
            
            &lt;plugin&gt;
                &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                &lt;version&gt;3.5.1&lt;/version&gt;
                &lt;configuration&gt;
                    &lt;source&gt;1.7&lt;/source&gt;
                    &lt;target&gt;1.7&lt;/target&gt;
                &lt;/configuration&gt;
            &lt;/plugin&gt;
            
            &lt;plugin&gt;
                &lt;groupId&gt;com.atlassian.plugin&lt;/groupId&gt;
                &lt;artifactId&gt;atlassian-spring-scanner-maven-plugin&lt;/artifactId&gt;
                &lt;version&gt;${atlassian.spring.scanner.version}&lt;/version&gt;
                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;atlassian-spring-scanner&lt;/goal&gt;
                        &lt;/goals&gt;
                        &lt;phase&gt;process-classes&lt;/phase&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
                &lt;configuration&gt;
                    &lt;scannedDependencies&gt;
                        &lt;dependency&gt;
                            &lt;groupId&gt;com.atlassian.plugin&lt;/groupId&gt;
                            &lt;artifactId&gt;atlassian-spring-scanner-external-jar&lt;/artifactId&gt;
                        &lt;/dependency&gt;
                    &lt;/scannedDependencies&gt;
                    &lt;verbose&gt;false&lt;/verbose&gt;
                &lt;/configuration&gt;
            &lt;/plugin&gt;
        &lt;/plugins&gt;
    &lt;/build&gt;
    &lt;properties&gt;
        &lt;jira.version&gt;7.1.4&lt;/jira.version&gt;
        &lt;amps.version&gt;6.2.4&lt;/amps.version&gt;
        &lt;atlassian.spring.scanner.version&gt;1.2.13&lt;/atlassian.spring.scanner.version&gt;
        &lt;jira.software.application.version&gt;7.0.10&lt;/jira.software.application.version&gt;
        &lt;jira.servicedesk.application.version&gt;3.1.9&lt;/jira.servicedesk.application.version&gt;
    &lt;/properties&gt;
&lt;/project&gt;

I just don't get it sad

Did you ran my code with the same problem?

Volodymyr Krupach
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.
August 31, 2016

I did not try your code but I believe I will have the same problem. If you really want to find the cause start replacing files in your project with files from working project. There are only 3 of thgem: pom.xml, atlassian-plugin.xml and test.js.

Jeff Morgan August 31, 2016

So I started a complete new project, rewrote the pom.xml and atlassian-plugin.xml from scratch and added my java/vm files - no js files added so far.

&lt;web-resource key="general-resources"&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:ajs&lt;/dependency&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:dialog2&lt;/dependency&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:aui-table-sortable&lt;/dependency&gt;
        &lt;dependency&gt;com.atlassian.auiplugin:aui-experimental-iconfont&lt;/dependency&gt;
        &lt;resource type="download" name="todo.css" location="/css/todo.css" /&gt;
        &lt;resource type="download" name="todo.js" location="/js/todo.js" /&gt;
        &lt;resource type="download" name="images/" location="/images" /&gt;
        &lt;context&gt;atl.general&lt;/context&gt;
    &lt;/web-resource&gt;

and in the todo.js

"use strict";
AJS.toInit(function($) {
  alert(AJS.dialog2); //1
  alert(AJS.tablessortable); //2
});
  1. prints the expected funktion
  2. prints again undefined

This drives me mad...!

 

edit:

It works if I use aui-experimental-table-sortable (??)

Also disabling the web batching for debugging purpose does not work, if I disable it and reload the page, everything breaks:

Volodymyr Krupach
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.
August 31, 2016

Did you add com.atlassian.auiplugin:aui-table-sortable after launching the addon without it? It looks like JS resources are not reloaded after they are changed.

I suggest you to give up the scanner approach and build the addon old way. Anyway "spring scanner 1.x" does not bring any significant value and creates too much troubles and Atlassian is replacing it with "spring scanner 2.0". See details here: https://bitbucket.org/atlassian/atlassian-spring-scanner.

Personally I am going to stick with the old tags approach till spring scanner becomes stable. I just do not have time to dig around all pitfalls that come with current spring scanner. I need to concentrate on my clients' business problems and not on some hacky stuff smile.

TAGS
AUG Leaders

Atlassian Community Events