Grails资源插件

时间:2014-02-17 19:53:07

标签: grails

试图了解grails和resources插件。我已经读过它了。我也读过它不是,你必须将它作为运行时插件添加到配置文件中。 那么问题是正确的吗?当我尝试将其添加到我的Config.groovy文件时,我收到一个错误。

  

|打包应用程序时出错错误:加载Config.groovy时出错:否   签名方法:   groovy.util.ConfigSlurper $ _parse_closure5.runtime()适用于   参数类型:(java.lang.String)values:[:resources:1.2]

Config.groovy文件

grails {

    plugins {
        runtime ':resources:1.2'
        runtime ":cached-resources:1.0"
        runtime ":yui-minify-resources:0.1.5"
    }
}

更新后的帖子: 发帖后对不起我读到它必须在我的构建配置中,但现在得到不同的错误。

  

2014-02-17 15:03:44,111 [localhost-startStop-1]错误   payment-gateway:plugins.DefaultGrailsPluginManager - 错误   为插件配置动态方法[资源:1.1.6]:   COM /雅虎/平台/衣/压缩机/ JavaScriptCompressor   java.lang.NoClassDefFoundError:   com / yahoo / platform / yui / compressor / JavaScriptCompressor at   java.lang.Class.privateGetDeclaredMethods(Class.java:2475)at at   java.lang.Class.getDeclaredMethods(Class.java:1818)at   org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)     在org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)     在   org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)     在org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)     在   com.blockconsult.yuiminifyresources.YuiJsMinifyResourceMapper.map(YuiJsMinifyResourceMapper.groovy:28)     在   org.grails.plugin.resource.mapper.ResourceMapper.invoke(ResourceMapper.groovy:139)     在   org.grails.plugin.resource.mapper.ResourceMapper.invokeIfNotExcluded(ResourceMapper.groovy:128)     在   org.grails.plugin.resource.ResourceProcessor.applyMappers(ResourceProcessor.groovy:587)     在   org.grails.plugin.resource.ResourceProcessor.prepareResource(ResourceProcessor.groovy:533)     在   org.grails.plugin.resource.ResourceProcessor $ _prepareSingleDeclaredResource_closure12.doCall(ResourceProcessor.groovy:602)     在   org.grails.plugin.resource.util.ResourceMetaStore.addDeclaredResource(ResourceMetaStore.groovy:29)     在   org.grails.plugin.resource.ResourceProcessor.prepareSingleDeclaredResource(ResourceProcessor.groovy:600)     在   org.grails.plugin.resource.ResourceProcessor $ _prepareResourceBatch_closure14.doCall(ResourceProcessor.groovy:625)     在   org.grails.plugin.resource.ResourceProcessorBatch.each(ResourceProcessorBatch.groovy:8)     在   org.grails.plugin.resource.ResourceProcessor.prepareResourceBatch(ResourceProcessor.groovy:621)     在   org.grails.plugin.resource.ResourceProcessor.resourcesChanged(ResourceProcessor.groovy:804)     在   org.grails.plugin.resource.ResourceProcessor.loadModules(ResourceProcessor.groovy:800)     在   org.grails.plugin.resource.ResourceProcessor.reloadAll(ResourceProcessor.groovy:1056)     在   ResourcesGrailsPlugin $ _closure3.doCall(ResourcesGrailsPlugin.groovy:172)     at java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:303)     在java.util.concurrent.FutureTask.run(FutureTask.java:138)at   java.util.concurrent.ThreadPoolExecutor中的$ Worker.runTask(ThreadPoolExecutor.java:895)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:918)     在java.lang.Thread.run(Thread.java:680)引起:   抛出java.lang.ClassNotFoundException:   com.yahoo.platform.yui.compressor.JavaScriptCompressor at   java.net.URLClassLoader $ 1.run(URLClassLoader.java:202)at   java.net.URLClassLoader.findClass(URLClassLoader.java:190)at   java.lang.ClassLoader.loadClass(ClassLoader.java:306)at   java.lang.ClassLoader.loadClass(ClassLoader.java:247)... 26更多

2 个答案:

答案 0 :(得分:0)

如插件documentation中所述,您需要在BuildConfig.groovy而不是Config.groovy

中安装插件
  

要使用该插件,请将其添加到BuildConfig.groovy:

plugins {
   runtime ':resources:1.2'
}

答案 1 :(得分:0)

我认为需要进入BuildConfig:

plugins {
    runtime ':resources:1.2'
    runtime ":cached-resources:1.0"
    runtime ":yui-minify-resources:0.1.5"
}