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!
Community moderators have prevented the ability to post new answers.
Ok... Problem solved, sorry for wasting your time.
Unspottable mistake: <context> atl.general </context> and not <context> atl-general </context>
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 WebResourceManager
can 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please change the dependency to <dependency>com.atlassian.auiplugin:ajs</dependency>.
Does this work?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think that you have omitted this </web-resource>
Are you specified the required resources in your edit-kbs.vm?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.