Upgrading jquery.js in primefaces.jar without modifying the JAR

jquery, jsf, primefaces

Solution

Just put the desired `jquery.js` file in your own webapp project with the same resource identifier as PrimeFaces is using for its bundled jQuery: `primefaces:jquery/jquery.js`. Webapp's own resources with the same identifier have loading precedence over those in JARs.

Thus, here:

WebContent
 |-- META-INF
 |-- WEB-INF
 |-- resources
 |    |-- primefaces
 |    |    `-- jquery
 |    |         `-- jquery.js
 :    :

Alternatively, just upgrade PrimeFaces itself. 3.1 is quite ancient anyway.

Problem

I am working with Primefaces 3.1 and I found a bug in the jquery.js used (the bug is described and fix here: http://forum.jquery.com/topic/datepicker-doesn-t-work-inside-fixed-div). I am wondering if there is an elegant way for replacing the .js? The replacement directly in the jar cannot be done because we are using Maven and I don't want to customise a library. Currently, I replaced the HeadRenderer to remove the jquery.js from the header and I added my own js file, but there's maybe a Primefaces built-in option to do the same?

Original source