Skip to content

fobo66/propertiesLoader

Folders and files

NameName
Last commit message
Last commit date
Aug 3, 2024
Oct 2, 2023
Jan 24, 2025
Jan 4, 2023
Sep 19, 2019
Sep 24, 2019
Jan 13, 2023
Feb 21, 2025
Oct 2, 2023
Dec 20, 2024
Jul 11, 2024
May 5, 2022
Dec 2, 2024

Repository files navigation

PropertiesLoader Gradle plugin

This simple plugin allows you to load properties (such as API keys) from .properties files into project extras.

Usage

First of all, load plugin in your root project's build.gradle file:

plugins {
    id "io.github.fobo66.propertiesloader" version "1.0"
}

For Kotlin DSL:

plugins {
    id("io.github.fobo66.propertiesloader") version "1.0"
}

Then you need to specify .properties files for the plugin:

propertiesLoader {
    propertiesFiles.from(project.file("api.properties"))
}

Given api.properties has the following content:

testkey=CHANGE_ME

Then you can access testkey via project extras in your tasks. In Groovy DSL:

ext.testkey
// or for task context
project.ext.testkey

For Kotlin DSL:

val testkey : String by extra
// or for task context
val testkey = project.extensions.extraProperties.get("testkey")

Examples

To see an example of how to use this plugin, see functional tests. There are all the needed properties defined in test cases in build.gradle "files".