Build.gradle: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 47: Line 47:


=Repositories=
=Repositories=
Repositories are declared in the
<syntaxhighlight lang='groovy'>
repositories {
}
</syntaxhighlight>

Revision as of 21:32, 1 May 2018

External

Internal

Overview

The project-level configuration script that contains task configuration for the current project, written in the Gradle's DSL. It tells Gradle what to build. The build script may contain any Groovy language element, including:

To make build scripts more concise, Gradle automatically adds the set of default Gradle import statements to the script.

Variables

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

Repositories

Repositories are declared in the

repositories {
}