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

Web-resource not loaded (?) while following plugin guide

Quentin Genies May 6, 2013

Greetings,

I have been developping a few basic plugins for JIRA 5.1, not to mention I struggled with some points but eventually managed to make them work.

But since a few days (for no particular reason), my Javascripts aren't loaded anymore (whether it be on dev instance or test server). I followed step to step the guide to build a clean plugin (again) but I guess something must be missing.

Basically the idea is just to make a Javascript load on each page (context atl-general).

Here are the important code parts:

<web-resource key="MAF-CARREFOUR-DEV-resources" name="MAF-CARREFOUR-DEV Web Resources">
    <dependency>jira.webresources:global-static</dependency>
    <resource type="download" name="kbs.css" location="css/kbs.css"/>
    <resource type="download" name="kbs.js" location="js/kbs.js"/>
    <resource type="download" name="images/" location="images"/>
    <context>atl-general</context>
</web-resource>
<customfield-type name="KB Search" i18n-name-key="kb-search.name" key="kb-search" class="com.atlassian.mafcarrefour.jira.customfields.KBSearch">
    <description key="kb-search.description">The KB Search Plugin</description>
    <!-- <resource name="view" type="velocity" location="/templates/customfields/kb-search/view.vm"/>
    <resource name="edit" type="velocity" location="/templates/customfields/kb-search/edit.vm"/>
    <resource name="edit-kbs" type="velocity" location="/templates/customfields/kb-search/edit-kbs.vm"/> -->
    <resource name="edit" type="velocity" location="/templates/plugins/fields/edit/edit-kbs.vm"/>
  </customfield-type>

My Velocity Template is being loaded normally, but not the web-resource section. They are located in my main/resource folder on Eclipse project.

I have tried everything I could think of. Any thoughts?

Cheers!

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Quentin Genies May 7, 2013

Ok... Problem solved, sorry for wasting your time.

Unspottable mistake: <context> atl.general </context> and not <context> atl-general </context>

Vinutha Vasan February 24, 2014

Hi Genies,

I am trying to load the javascript in a plugin as webresource module.

I tried as per the instructions available @https://developer.atlassian.com/display/JIRADEV/Web+Resource+Plugin+Module

Below is the implementation detail,

1. web-resource enty in atlassian-plugin.xml

<web-resource key="hideVersionCreationForm" name="HideVersionCreationForm" >

<resource type="download" name="hideVersionCreationForm.js"

location="includes/js/hideVersionCreationForm.js" />

<context>atl.admin</context>

</web-resource>

2. hideVersionCreationForm.js file

function hideAddVersion() {

AJS.$(".project-config-versions-add-fields").remove()

}

(function($){

function delayedHideAddVersion() {

setTimeout('hideAddVersion()',500)

}

$(document).ready(function(){

var url = window.location.pathname;

filename = url.substring(url.lastIndexOf('/')+1);

if (filename == "versions") {

console.log(window.location.href)

delayedHideAddVersion();

}

});

})(AJS.$);

3. Calling requiredResource method

The reference to WebResourceManagercan is injected into your constructor and callingwebResourceManager.requireResource.. in the doDefault as shown below,

webResourceManager.requireResource("version.management.plugin:hideVersionCreationForm");

Please let me know if I am doing anything wronge here, My javascript is not loading. But if I put the same js in announcment banner its working fine.

Thanks,

Vinutha

0 votes
codelab expert
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.
May 6, 2013

Please change the dependency to <dependency>com.atlassian.auiplugin:ajs</dependency>.

Does this work?

Quentin Genies May 6, 2013

Tried it. Doesn't change a thing, still getting the log warning when refreshing the page. :(

And by the way why is it putting this dependency in default plugin creation, what does it have to do with AUI or jQuery for including resources?

0 votes
Nadir MEZIANI
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.
May 6, 2013

Hi,


I think that you have omitted this </web-resource>
Are you specified the required resources in your edit-kbs.vm?

Quentin Genies May 6, 2013

Forgot a line in the copy-paste, it is indeed closed.

I thought you didn't have to specify anything like $webResource.require() after JIRA 5.x, right?

Well, at least for a month all my plugins were working without doing that!

Quentin Genies May 6, 2013

Now I'm getting this in the log:

2013-05-07 16:23:19,388 http-2990-3 WARN admin 983x504x1 h34vdv 0:0:0:0:0:0:0:1 /secure/EditAction!default.jspa [atlassian.plugin.webresource.DefaultResourceDependencyResolver] Cannot include disabled web resource module: com.atlassian.mafcarrefour.MAF-CARREFOUR-DEV:kb-search

2013-05-07 16:23:26,085 http-2990-6 WARN admin 983x525x1 h34vdv 0:0:0:0:0:0:0:1 /secure/IssueAction!default.jspa [atlassian.plugin.webresource.DefaultResourceDependencyResolver] Cannot include disabled web resource module: com.atlassian.mafcarrefour.MAF-CARREFOUR-DEV:kb-search

Radu Dumitriu
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.
May 6, 2013

Quentin, I think that error explains it: "disabled web resource module". You must find out why the resource is disabled, try to enable the module and look in the logs.

Quentin Genies May 7, 2013

I appreciate the attempts to help.

Although the cmd says the module is disabled, on the application's plugin manager side, it isn't. The web-resource module is enabled as well as the custom field kb-search. I tried disabling manually all the modules individually and the entire plugin without any success of new log message popping and explaining why this is happening.

This is getting on my nerves!

TAGS
AUG Leaders

Atlassian Community Events