Gradle plugin to expand dotted properties into nested maps.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Gradle Config Plugin

(aka Gradle Property Utilities Plugin)

Gradle plugin to expand dotted properties into nested objects.

In Java applications it is a common practice to use property names in dotted notation, e.g. aws.s3.bucket. It also may be desirable to work with the values as nested structures.

Alas, dotted names are not auto-expanded by Groovy. Thus, properties set on the command line or in file can be accessed in a build script only via plain string keys, e.g. project.ext['aws.s3.bucket'].

This tiny plugin for Gradle aspires to do the trick.

JDK 1.7 is required.

The latest stable version is 0.4.5.

Quick Start

buildscript {
    repositories {
    dependencies {
        classpath group: 'com.esyfur', name: 'gradle-config-plugin', version: '0.4.+'

apply plugin: 'config'


gradle test -Pbuild.version=1.23 and build.version values will now be available in build.gradle as nested objects:

task test << {
    println 'Build Name:    ' +
    println 'Build Version: ' +

It is also possible to leverage the safe navigation operator:

assert ?: 'com.esyfur.gradle' == 'com.esyfur.gradle'


To avoid name collisions, the plugin creates config property and uses it as the root scope for all processed values.

It is possible to change the name of the property by defining config.namespace value in

config.namespace = cfg

Loading .properties files

Gradle automatically reads settings from files in project build and user home directories. But no concise ways provided to load arbitrary Properties files.

This plugin adds a handy load() helper for that:


The method accepts java.nio.file.Path, or a String. If the given path isn't absolute, it is treated as relative to projectDir. If the file name does not have an extension, .properties is assumed.


The implementation is trivial and was initially borrowed from @OverZealous's answer on StackOverflow, but in v0.3 it was replaced with ConfigObject and ConfigSlurper.