Keep your secrets secret. External build properties support for your Gradle scripts.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
docs Add migration guide Mar 7, 2018
gradle Prepare for 0.4.1 release Apr 17, 2018
plugin Remove deprecated annotation on BuildProperties.file method Apr 17, 2018
sample Use ProjectPropertiesEntries in the sample Mar 2, 2018
LICENSE.txt Update year in LICENSE file Nov 14, 2016 Prepare for 0.4.1 release Apr 17, 2018 Link Groovydoc in readme and release documenatation Mar 8, 2018
gradlew Bump Gradle version to 4.3.1 Nov 25, 2017



External properties support for your gradle builds.

Using the old com.novoda:build-properties-plugin? You should migrate away from it as soon as possible.


Gradle builds are highly configurable through various properties. Rather than hardcoding these properties in your build scripts, for security reasons and in order to increase modularity, it's a common practice to provide these properties from external sources.

This plugin aims to provide a simple way to:

  • consume properties from external and internal sources like project properties, system properties, files etc.
  • define a custom source for properties
  • configure Android build with external properties

Adding to your project

Apply the plugin from jCenter as a classpath dependency:

buildscript {
  repositories {
  dependencies {
    classpath 'com.novoda:gradle-build-properties-plugin:0.4.1'

apply plugin: ''

or from the Gradle Plugins Repository:

plugins {
    id '' version '0.4.1'

Simple usage

Add a buildProperties configuration to your build script listing all the properties files you intend to reference later on:

buildProperties {
    secrets {
        using project.file('')

where is a properties file containing key/value pairs:


that can now be referenced in the build script as buildProperties.secrets:

boolean enabled = buildProperties.secrets['a'].boolean
int count = buildProperties.secrets['b'].int
double rate = buildProperties.secrets['c'].double
String label = buildProperties.secrets['d'].string

It is important to note that values are lazy loaded too. Trying to access the value of a specific property could generate an exception if the key is missing in the provided properties file, e.g.:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> No value defined for property 'notThere' in 'secrets' properties (/Users/toto/novoda/spikes/BuildPropertiesPlugin/sample/properties/

Advanced usage

For more advanced configurations, please refer to the advanced usage.