I've created plugin for my JIRA which is using servlets and web-resources with few .js files. Unfortunatelly, I have problems while installing new versions of my plugin with changes in javascript files.
Declaration (atlassian-plugin.xml):
<web-resource name="Admin Web Resources" key="jirasyncresources">
...
<resource type="download" name="admin.js" location="admin.js"/>
....
</web-resource>
Simple situation:
1. I'm preparing JAR file with my plugin.
2. Installing plugin on my JIRA instance.
3. Uninstalling plugin from my JIRA instance (also deleting every plugin's JARs from JIRA\plugins\installed-plugins).
4. Making changes in admin.js file.
5. Creating new JAR file (atlas-clean, atlas-package)
6. Installing my new JAR on the same JIRA instance.
Plugin works but it's still using old version of admin.js (without changes from point 5). Probably JIRA keeps somewhere all web-resources and doesn't update them while installing new version of plugin.
Where JIRA is keeping all web-resources? Is it possible do clean them?
(I'm using JIRA 4.4)
Community moderators have prevented the ability to post new answers.
I am guessing it is your browser that caches the files. Clear the cache and try again. Sometimes you just need to reload the page (Ctrl+F5 on firefox for eg.).
You're right, it's browser cache problem. Any way to force refreshing those files (in code)? Reloading doesn't help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can rename the files in webresource which will force the browser to reload. Maybe use a versioning of files there!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Renaming files doesn't help because JIRA joins all .js files into one big "jirasyncresources.js". I can change web-resource key but it doesn't look like good solution - it will force me to change all "$webResourceManager.requireResource" declarations in every .vm file which is using my resources.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, I meant webresource key. And yes, it will surely force you to change all references. I think you will have to have multitple webresource definitions to ease the pain! Unfortunately I don't know of any other solution. Someone else might ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
(This is written with confluence in mind, but i guess it applies to JIRA aswell).
Asking the userbase to actively clear their cache is moronic.
Since web-resources are cached by their key it is needed to change this every time a new plugin update is released..
Including web-resource by their context instead of the key, makes it possible to add a randomly generated value to the web-resource key (thus forcing a resource update).
The random value i chose is simply the maven build timestamp
<properties> <timestamp>${maven.build.timestamp}</timestamp> </properties>
<web-resource key="${project.artifactId}-resources${timestamp}" name="${project.artifactId} resources"> ... <context>something.something.something</context> </web-resource>
$webResourceManager.requireResourcesForContext("something.something.something")
I haven't been able to access images with requireResourcesForContext, and my solution has been to create a normal web-resource only containing images.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This sounded like such a good idea. I tried it, and indeed the key gets a timestamp appended to it. But after uploading the new plugin to Jira, the old sequence number on the batch.js file remains the same, so the browser's cached copy remains active.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I take that back... Further testing shows the sequence number stays the same, but there's a hash code in the URL that changes, so the new resources are indeed loaded. Thank you for your solution! Updating the plugin version number works as well, but you have to be careful, as Jira seems to refuse to install an "older" version plugin unless you uninstall first (so you can't add a timestamp during development then drop it for publishing unless you are careful to also increment your version number).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yea, common pitfalls was to ensure that the testing environment was not in dev mode. and not to test with atlas-cli, as that keeps building with the same timestamp
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your approach to updating the plugin version seems more feasible to me. Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To update the plugin version automatically, change pom.xml by updating <project><version> to include .${maven.build.timestamp}.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
note that the default timestamp does not contain seconds, this can be fixed within <maven.build.timestamp.format></maven.build.timestamp.format>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To fix this caching for new version of plugin. Whenever you changed the version in pom.xml then new web resource will be download at the client side.
Step 1: Add the version in plugin.xml file.
<web-resource key="transaction-${project.version}" name="transaction-resources">
<context>transaction-resources</context>
</web-resource>
Step 2: Call the web resource context in your tmplate(.vm file).
<head>
$webResourceManager.requireResourcesForContext("transaction-resources")
</head>
Now if you release new version of your plugin then web resource key will be changed and new web resource will be download in client side.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there anything that Wikipedia does not provide?
http://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache#Google_Chrome
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As rafal.pysz said, a good way to force to load updated resources without having user to clear the cache for the page, is to change the web resource name (add a version number or something), in atlassian-plugin.xml.
Such as:
"<web-resource key="my-web-resources-v001".."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's client (browser) side, so I usually check that the browser cache has been cleared and then it refreshes nicely. I would like a "don't cache files from this site" choice in Chrome or Firefox. Using an incognito window in Chrome might work?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.