Note, this information is taken from user Big Ed at StackOverflow. Thanks Ed!
Create a properties file myExternalProperties.groovy
and put it on your classpath (such as the $TOMCAT_HOME/lib
directory).
Create a configuration file grails-app/conf/MyConfig.groovy
to use the external configuration values (if needed). You will not be able to use the properties defined in myExternalProperties.groovy
within grails-app/conf/Config.groovy
.
Edit grails-app/conf/Config.groovy
. Uncomment the lines the define grails.config.locations
and add this:
grails.config.locations << "classpath:MyExternalProperties.groovy"
grails.config.locations << "classpath:MyConfig.groovy"
Add the following to scripts/Events.groovy
(which probably needs to be created).
eventCompileEnd = {
ant.copy(todir:classesDirPath) {
fileset(file:"${basedir}/grails-app/conf/MyConfig.groovy")
}
}
That last part is very important.