In my grails app, I use a third party library which makes heavy use of getClass().getClassLoader().getResource("/some/thing")
- resource loading with absolute paths.
Resources are in grails-app/conf
. Using grails run-app
the classloader used is a org.codehaus.groovy.grails.cli.support.GrailsRootLoader
. With this classloader, resolving fails when absolute paths are used. Resources do resolve without the preceeding "/" - e.g. some/thing
does resolve. Resources also do resolve with the preceeding "/" in unit tests or when the app is packaged as a war. This both does not really help.
How do I get GrailsRootLoader
to resolve absolute paths when I run the app with the grails
command ?
PS: I use grails-2.0.3 on Linux and tried Java versions 1.7.0_01 (Oracle) and 1.6.0_24 (OpenJDK).