Gradle Variables and Properties

From NovaOrdis Knowledge Base
Revision as of 01:26, 20 May 2018 by Ovidiu (talk | contribs) (Created page with "=Internal= * Project and Build Script * There are two kinds of variables that can be declared in a build script...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Internal

There are two kinds of variables that can be declared in a build script: local variables and extra properties.

Local Variables

Local variables, which are a feature of the underlying Groovy language, are declared with the "def" keyword. They are only visible in the scope where they have been declared.

def myVariable = "something"
...
println myVariable

Extra Properties

Extra properties can be declared as follows:

...
ext {
    log4jVersion = "2.1.7"
    emailNotification = "build@example.com"
}
...