Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to include local JavaScript file in Velocity template?

nad
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 29, 2020

I have included my JS file in my webresource atlassian XML like so in bold:

<web-resource key="jira-custom-field-example-resources" name="jira-custom-field-example Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="jira-custom-field-example.css" location="/css/jira-custom-field-example.css"/>
<resource type="download" name="jira-custom-field-example.js" location="/js/jira-custom-field-example.js"/>
<resource type="download" name="oauth-signature.js" location="/js/oauth-signature.js"
/>
<resource type="download" name="images/" location="/images"/>
<context>jira-custom-field-example</context>
</web-resource>

 This is how I have it included in my vm file:

<script src="oauth-1.0a.js"></script>

When I run atlas-run, I get an error because I believe it is trying to be loaded from the localhost. The error I get is:

Loading failed for the <script> with source “http://localhost:2990/jira/browse/oauth-1.0a.js”. 

 

How can I load the JS file from the relative path. It is currently in this path:

C:\Users\nad\Desktop\DevOps\Custom\jira-custom-field-example\src\main\resources\js

1 answer

0 votes
Qusai Atoon May 29, 2023

I know this question was asked a long time ago, but I'm facing the same problem right now. 

 

Can you please tell me how did you figure it out if you did? 

 

I really appreciate any help you can provide. 

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, mindful member, mindful member badge, atlassian community, community kudos, community giveaway, atlassian swag, community values, empathy and kindness, badge challenge, atlassian learning, community engagement, swag giveaway

Earn a Badge, Win a Prize 🎁

Earning the Mindful Member badge proves you know how to lead with kindness, plus it enters you into a giveaway for exclusive Atlassian swag. Take the quiz, grab the badge, and comment on our announcement article to spread the good vibes!

Start here
AUG Leaders

Atlassian Community Events