部署后禁用grails 2.0资源处理 [英] Disable grails 2.0 resources processing, after deploy

查看:189
本文介绍了部署后禁用grails 2.0资源处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的应用打包成一场战争(由 grails war ),正如我所看到的,它已经构建了所有必需的资源。例如,我有 coffeescript 代码,它们已被转换为 js dir。同样的 scss 等等。我的意思是我拥有所有的静态资源,可以直接服务(我想从Nginx服务器,而不是Tomcat服务器)。

b
$ b

但是在将这个 war 部署到Tomcat之后,出现如下错误:

  ERROR plugins.DefaultGrailsPluginManager  - 为插件配置动态方法时出错[资源:1.1.6]:java.lang.NoSuchMethodError:org.mozilla.javascript.Parser.parse(Ljava / io /阅读器; Ljava /郎/字符串; I)Lorg / Mozilla浏览器/ JavaScript的/ ScriptOrFnNode; 
org.codehaus.groovy.runtime.InvokerInvocationException:java.lang.NoSuchMethodError:org.mozilla.javascript.Parser.parse(Ljava / io / Reader; Ljava / lang / String; I)Lorg / mozilla / javascript / ScriptOrFnNode;
在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:441)$ b $在java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
在java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(ThreadPoolExecutor.java:886)
在java.util.concurrent .ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
引起:java.lang.NoSuchMethodError:org.mozilla.javascript .Parser.parse(Ljava / IO /阅读器; Ljava /郎/字符串; I)Lorg / Mozilla浏览器/ JavaScript的/ ScriptOrFnNode;
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)

这个来自 yui-minify-resources 插件。类似的事情发生在 coffeescript-resources 插件上。也许这是因为这个插件有什么问题,但这很疯狂,因为我已经拥有了所有的资源,准备/处理/编译为静态文件。在生产模式下,我不需要这个插件。



如何禁用生产模式下的所有资源插件?是否有可能?



同样的事情为 grails run-war

coffeescript-resources 和 yui-minify-resources code>都依赖于Rhino的javascript引擎,但YUI团队已经制作了对它们的Rhino版本进行了一些修改,导致它与香草犀牛不兼容。你有两种选择:
$ b


  1. 尝试使用类加载器

  2. 不要使用YUI压缩器


I've packaged my app into a war (by grails war), and as I see, it have built all required resources. For example I have coffeescript code, that have translated to into js dir. Same for scss, etc. I mean I have all static resources, that can be served directly (and I want to server it from Nginx, not Tomcat)

But after deploying this war into Tomcat, I'm getting errors like:

ERROR plugins.DefaultGrailsPluginManager  - Error configuring dynamic methods for plugin [resources:1.1.6]: java.lang.NoSuchMethodError: org.mozilla.javascript.Parser.parse(Ljava/io/Reader;Ljava/lang/String;I)Lorg/mozilla/javascript/ScriptOrFnNode;
org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoSuchMethodError: org.mozilla.javascript.Parser.parse(Ljava/io/Reader;Ljava/lang/String;I)Lorg/mozilla/javascript/ScriptOrFnNode;
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NoSuchMethodError: org.mozilla.javascript.Parser.parse(Ljava/io/Reader;Ljava/lang/String;I)Lorg/mozilla/javascript/ScriptOrFnNode;
    at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)

This one is from yui-minify-resources plugin. Similar thing happening for coffeescript-resources plugin. Maybe it's because there is something wrong with this plugins, but it's crazy, because I already have all resources, prepared/processed/compiled to static files. I don't need this plugins on production mode.

How I can disable all this resource plugins on production mode? Is it possible?

PS same thing for grails run-war

解决方案

This is likely due to coffeescript-resources and yui-minify-resources both having a dependency to Rhino javascript engine, but the YUI team has made some modifications to their version of Rhino, which causes it to be incompatible with vanilla Rhino. You have two options:

  1. Try hacking around with classloaders
  2. Don't use YUI compressor

这篇关于部署后禁用grails 2.0资源处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆