Cant import JS in Jira plugin

Angel Peña October 24, 2019

Hello!

I've been trying to develop a simple plugin that uses a JS code to do some things.

Unfortunately i can't import the JS in the velocity file.

I'm using a web resource component:

<web-resource name="Button Resources" i18n-name-key="button-resources.name" key="button-resources">
<description key="button-resources.description">The Button Resources Plugin</description>
<resource name="ButtonJS" type="download" location="js/button.js"/>
<dependency>confluence.web.resources:ajs</dependency>
</web-resource>

 And i have a very simple script to test located in /my-plugins/button-test/plugin/src/main/resources/js:

//button.js
<script>
alert("asd");
</script>

finally, in my velocity file i have the following code:

$webResourceManager.requireResource("com.example.plugins.tutorial.tutorial-jira-add-content-to-view-issue-screen-mine:button-resources")


<button id="issue-btn" class="aui-button">Exportar</button>

The button shows correctly, but the alert does not appear.

Am i doing something wrong?

Thank you in advance.

1 answer

0 votes
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 25, 2019

Hi @Angel Peña ,

I may not the best person to ask this question, but I believe the same topic has already been discussed in the below Community threads and external links:

You may want to review the above links to see if in there you can find the answer to your question. 

Otherwise, in case you don't find anything useful in the provided links and you don't manage to get any other reply in the next days, I would advise to refer to the resources listed in https://developer.atlassian.com/resources:

 

I hope this helps.

 

Cheers,
Dario

Angel Peña October 30, 2019

Thank you!

I tried the links you provided, but unfortunately, i could not solve my issue.

I'll proceed to create a question in the developers community.

Greetings.

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 31, 2019

You are very welcome @Angel Peña!

Also, if you have time, once you will get your question answered in one of the other resources please paste the solution in here as well.

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer