How do you configure Grape to look for a custom configuration file at a location other than the default of ~/.groovy/grapeConfig.xml
? Unfortunately the official documentation at http://groovy.codehaus.org/Grape appears to be incomplete and doesn't cover this particular case.
For example, I'd like to specify a path such as $PROJECT_DIR/src/main/resources/groovyConfig.xml
so that other members in my team don't have to create and maintain their own groovyConfig.xml
files in their user/home directories.
To set a custom path to the Grape configuration file, set the grape.config
system property, e.g. if grape.config
is set to /home/user/customGrapeConfig.xml
then Grape will use that as the configuration file.
The full list of options related to Grape configuration files, according to a Groovy Developers' mailing list thread, is as follows:
grape.config
(if it is set) as the path to the configuration file.grape.config
is not set, then:
groovy.root
system property is set, Grape will look for the configuration file in the directory specified; otherwisegroovy.root
is not set, it uses ${user.home}/.groovy/
as the Groovy root directory and looks for a configuration file there.defaultGrapeConfig.xml
is retrieved from GrapeIvy's classloader (i.e. from the Groovy JAR). If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With