问题描述
我最近将 grails 应用程序升级到 2.4.3,并在此过程中将资源插件升级到 1.2.14.我意识到此时资产插件是首选,但我还不能进行切换.我在 ApplicationResources.groovy 中定义了以下内容
I've recently upgraded a grails app to 2.4.3 and in the process upgraded the resources plugin to 1.2.14. I realize the assets plugin is preferred at this point, but I cannot make the switch just yet. I have the following defined in my ApplicationResources.groovy
modules = {
core {
resource url: '/js/main.js', disposition: 'head'
resource url: '/lib/bootstrap/css/bootstrap.css', disposition: 'head'
... more here
}
}
当我运行应用程序时,我得到以下信息:
When I run the app, I get the following:
| Error 2015-02-01 23:13:40,005 [localhost-startStop-1] ERROR resource.ResourceMeta - Resource not found: /lib/bootstrap/css/bootstrap.css
如果您查看我附上的图片,您会发现该文件确实位于正确的位置,并且这适用于旧版本的资源插件.
If you look at the image I've attached, you can see that this file is indeed in the correct place, and this worked with an older version of the resources plugin.
推荐答案
Grails Resources 插件使用 grails.resources.adhoc.patterns
和 grails.resources.adhoc.includes
Config.groovy
中的 code> 值以确定要处理的资源.也许这种行为在不同版本之间发生了变化,您需要像这样添加 lib 目录:
The Grails Resources plugin uses the grails.resources.adhoc.patterns
and grails.resources.adhoc.includes
values in Config.groovy
to determine which resources to process. Perhaps this behavior changed across versions and you need to add the lib directory like so:
grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*', '/lib/bootstrap/css/*']
grails.resources.adhoc.includes = ['/images/**', '/css/**', '/js/**', '/plugins/**', '/lib/bootstrap/css/**']
这篇关于Grails 资源插件升级后找不到/lib/文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!