Gregg
Gregg

Reputation: 35864

Grails Resources Plugin Not Finding /lib/ folder after upgrade

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.

directory structure of static resources

Upvotes: 1

Views: 554

Answers (2)

Parth Bhagat
Parth Bhagat

Reputation: 509

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.

Upvotes: 1

Lyle
Lyle

Reputation: 3793

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

Upvotes: 1

Related Questions