Project properties

In a Gradle build file, we can access several properties that are defined by Gradle, but we can also create our own properties. We can set the value of our custom properties directly in the build script and we can also do this by passing values via the command line.

The default properties that we can access in a Gradle build are displayed in the following table:

Name

Type

Default value

project

Project

The project instance.

name

String

The name of the project directory. The name is read-only.

path

String

The absolute path of the project.

description

String

The description of the project.

projectDir

File

The directory containing the build script. The value is read-only.

buildDir

File

Get Gradle Effective Implementations Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.