Maven will manage their sub-dependencies and your web pages can access the scripts direct from the jars. Lovely. Sign me up! Except wait, what? Webjars requires servlet 3 and GAE only supports 2.5. Boo. Thanks Google.
Google have been
quick off the mark unable to deal with this at all. There’s a fairly funny unsolved support request from way back in 2010 about it here .
Frustrated about this, and really surprised there was no existing workaround anywhere, I braved about eleventy million not particularly helpful bits of restlet documentation and finally came up with a workaround. Yay!
You’ll need restlet for this, I expect you could use restlet just for this around the rest of your <insert framework here> app, but as I’m using restlet anyway it works a treat.
//add the jars to your pom.xml and place this in your restlet router
//then you can fetch things from your html like this
final Directory dir = new Directory(getContext(), "clap://class/META-INF/resources/webjars");
This took me ages because the RESTlet website has been utterly broken for months and RESTlet behaves really rather oddly sometimes. It’s impossible to get hold of the application within the router and add the CLAP protocol (getApplication() is returning null) and if you attempt to add the correct client connector when building the application itself it somehow forgets by the time you get to the router. I’ve still no idea why.
What you can do is either (a) create a new component with a new context and add the CLAP protocol to it, or (b) modify your init-parms in the web.xml to contain CLAP, like so:
<param-value>HTTP HTTPS CLAP</param-value>
The add a new component workaround will log “SEVERE don’t do this” style warnings when you start up, so it’s best to do it in the web.xml if possible.