Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use a custom properties file

I would like to have a properties file that deployed with my application so that I can access it at runtime. How can I have my build.gradle file access my property file located in src/main/resources?

I would like to use this file as I would normal use gradle.properties.

like image 687
Mike Rylander Avatar asked Jun 28 '13 17:06

Mike Rylander


1 Answers

You want to read this properties file in your build.gradle file? You can simply:

def props = new Properties()
file("src/main/resources/my.properties").withInputStream { 
    stream -> props.load(stream) 
}
like image 181
Rene Groeschke Avatar answered Sep 19 '22 02:09

Rene Groeschke