Gradle Pass Configuration on Command Line: Difference between revisions

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


* [[Gradle_Operations#Pass_Configuration_on_Command_Line|Gradle Operations]]
* [[Gradle_Operations#Pass_Configuration_on_Command_Line|Gradle Operations]]
* [[Gradle_Variables_and_Properties#System_Properties|Gradle Variables and Properties - System Properties]]


=Overview=
=Overview=
Line 10: Line 11:


If not provided on command line, those configuration elements can always fall back to build.gradle hardcoded values.
If not provided on command line, those configuration elements can always fall back to build.gradle hardcoded values.
=Implementation=

Revision as of 20:15, 20 March 2019

Internal

Overview

It is sometimes necessary to pass environment-specific configuration to the build. An example is the URL of a container registry, which may different values relative to the environment the build is executed. The best place for such configuration is not build.gradle, as we would like to avoid editing it for each environment the build is supposed to execute in. One option, which works well for build containers, is to use custom environment variables. Another option is to use command line-specified system properties, as shown below:

gradle -Dmy.environment.dependent.config=blue build

If not provided on command line, those configuration elements can always fall back to build.gradle hardcoded values.

Implementation