Gradle 2.0-rc-1 is now available for testing

Ok, worked it out. It’s a bit curly.

The breakage is due to this change in Groovy: http://jira.codehaus.org/browse/GROOVY-6066

Basically, static initializers are now (correctly) only run when the class is first used. In this case, it means that the thread context class loader is different to what it was. This points out the other problem, in that the WebJars code is using the thread context class loader to load services here: https://github.com/webjars/webjars-locator/blob/master/src/main/java/org/webjars/WebJarAssetLocator.java#L75

The solution is to explicitly set the context classloader, like…

Thread.currentThread().contextClassLoader = WebJarAssetLocator.class.getClassLoader()

In your load* method.

Whew. Thanks a lot for the insight. That Groovy issue definitely looks conspicious. However, this does not seem to be a static initializer issue only because if I move the ‘loadCoffeeScriptResource()’ call to the constructor, there are no static initializers involved. Thanks for the workaround, it’s a works-for-me then. Looks like it’s a bug in the webjars-locator, I’ll try and understand what’s going on and report it there.