Grails frees us from writing a lot of boiler-plate code. But sometimes things come up which don’t go so well as expected. One such thing is related to user provided external configuration files in grails-app/conf directory which come in form of simple properties files.
We have been experiencing a problem with these files — they don’t always get picked up by grails during the first launch of the application. The properties in the files are not read. When you restart the application, the problem goes away. (grails 1.3.5)
As a workaround, we had to hook into the grails event processing infrastructure by putting a simple groovy script named Events.groovy in scripts folder of the project. Grails processes the script after each event. All you have to do is to decide which events are relevant to you. The advantage of this approach is that you don’t touch the grails code.
The workaround boils down to putting some code in the Events.groovy which reacts to the
CompileEnd event by copying all you properties files to the directory
grailsSettings.baseDir.path + '/grails-app/conf'.