Grails Resources Plugin Not Finding /lib/ folder after upgrade

橙三吉。 提交于 2019-12-04 02:20:15

问题


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.


回答1:


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/**']



回答2:


I know it is a very old question, but thought my finding would helpful to someone. If we place grails.resources.resourceLocatorEnabled = false in Config.groovy file then it should work. No need to add grails.resources.adhoc property.



来源:https://stackoverflow.com/questions/28271505/grails-resources-plugin-not-finding-lib-folder-after-upgrade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!