Passing Configuration to a Gradle Build via Custom Environment Variables: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 10: Line 10:


{{External|https://github.com/ovidiuf/playground/tree/master/gradle/custom-environment-variables}}
{{External|https://github.com/ovidiuf/playground/tree/master/gradle/custom-environment-variables}}
=Procedure=
The method consists in defining a {{Gradle_Variables_and_Properties#Extra_Properties|project extra property}} that is initialized with the value of the custom environment variable, or with a default value if the environment variable is not defined.

Revision as of 21:19, 14 March 2019

Internal

Overview

This article describes a generic method to pass configuration to a Gradle build using custom environment variables. This method could prove useful when Gradle builds are executed in containers, as it is the case for AWS CodeBuild builds.

Playground

https://github.com/ovidiuf/playground/tree/master/gradle/custom-environment-variables

Procedure

The method consists in defining a Template:Gradle Variables and Properties that is initialized with the value of the custom environment variable, or with a default value if the environment variable is not defined.