I want to use a js file in my plugin . so i add
<web-resource key="myresource" name="Myresource" >
<dependency>com.atlassian.auiplugin:ajs</dependency>
<dependency>jira.webresources:jira-global</dependency>
<dependency>jira.webresources:autocomplete</dependency>
<resource type="download" name="test.js" location="javascripts/test.js">
<property key="content-type" value="text/javascript"/>
</resource>
<context>page</context>
</web-resource>
to the atlassian-plugin.xml . Then I use #requireResource(“com.jira.plugin:myresource”) in my gadget xml file . But it seems doesn’t work . and test.js just includes alert(“haha”);
Does any one know how to add a external resource to the plugin ?? Thanks.
If it’s the same as in confluence, your xml, should work. Except, that you could remove the context part:
The path, in location attribute is relative to atlassian-plugin.xml
and prefix in #requireResource() is your plugins groupId.artifactId:myresource .
So, if your plugin pom.xml is:
The #requireResource() in your velocity template should look like this: