Not compatible with yui-resources
The current version of coffeescript-resources conflicts with yui-minify-resources. The following comment in yui-minify-resources may shed some light:
SamD says...
I'm seeing the same issue, anytime you are dealing with rhino it usually going to lead you down a road you aren't going to enjoy since there seems to be almost always something somewhere that is going to have a dependency on another version.
To make matters worse, if you are using yuicompressor they package their own modified version of rhino which has the same namespace making dealing with different versions of rhino difficult.
Running a dependency report you can see if you are using lesscss resources it has a runtime dependency on lesscss which itself has a dependency on rhino 1.7R3 http://search.maven.org/remotecontent? filepath=org/lesscss/lesscss/1.3.0/lesscss-1.3.0.pom
The issue I'm seeing now is a missing method on org.mozilla.javascript.Parser, on my classpath there are three different version of this class. One included in the yuicompressor by this plugin, another in the jar pulled in by lesscss resources and another in the core rt.jar itself
Given that this is not likely to be fixed in the near future - what workarounds is anyone using?
Well, to solve dependency problem in grails plugins it is possible to declare it in BuildConfig.groovy:
runtime(":coffeescript-resources:0.3.2") {
excludes "rhino"
}
However, I find it that Rhino version that is declared in yui-resources plugin is not able to compile coffee-script-1.3.1.js file :(
One possibility is to use something like jarjar to rename the Rhino classes needed by coffeescript and less, but this would of course involve embedding the Rhino classes in each plugin that needs them.
I started working on a patch for this issue here:
https://github.com/Spantree/grails-coffeescript-resources/tree/feature/issue-17-yui-resources-compatability
This feature branch repackages the rhino classes under org.grails.plugins.coffeescript.mozilla.
However, when testing with yui, I appear to be getting the following errors:
Caused by AbstractMethodError: null
->> 1111 | evaluateString in org.grails.plugins.coffeescript.mozilla.javascript.Context
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 49 | compile in org.grails.plugins.coffeescript.CoffeeScriptEngine
| 25 | map . . in CoffeeScriptResourceMapper
| 139 | invoke in org.grails.plugin.resource.mapper.ResourceMapper
| 128 | invokeIfNotExcluded in ''
| 587 | applyMappers in org.grails.plugin.resource.ResourceProcessor
| 533 | prepareResource in ''
| 602 | doCall in org.grails.plugin.resource.ResourceProcessor$_prepareSingleDeclaredResource_closure12
| 29 | addDeclaredResource in org.grails.plugin.resource.util.ResourceMetaStore
| 600 | prepareSingleDeclaredResource in org.grails.plugin.resource.ResourceProcessor
| 625 | doCall . in org.grails.plugin.resource.ResourceProcessor$_prepareResourceBatch_closure14
| 8 | each in org.grails.plugin.resource.ResourceProcessorBatch
| 621 | prepareResourceBatch in org.grails.plugin.resource.ResourceProcessor
| 804 | resourcesChanged in ''
| 800 | loadModules in ''
| 1056 | reloadAll in ''
| 172 | doCall . in ResourcesGrailsPlugin$_closure3
| 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run . . in java.util.concurrent.FutureTask
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run . . in ''
I'm not exactly certain of the cause yet, but it may have something to do with Java's Scripting engine binding the old org.mozilla classes to the scripting context. Unfortunately, I don't know Rhino well enough yet to diagnose the problem.