这是indexloc提供的服务,不要输入任何密码
Skip to content

fobo66/propertiesLoader

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".

About

Gradle Plugin for loading values from Properties file

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages