Gradle Project Coordinates, State and Configured Properties: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 5: Line 5:
The project coordinates such as [[#Name|name]], [[#Group|group]], [[#Version|version]], [[#Description|description]] and [[#Path|path]] can be read from [[build.gradle]] as values of DSL variables. Some of the coordinates, such as [[#Group|group]], [[#Version|version]] and [[#Description|description]] can also be set. The coordinates are also available programmatically via the Project API.
The project coordinates such as [[#Name|name]], [[#Group|group]], [[#Version|version]], [[#Description|description]] and [[#Path|path]] can be read from [[build.gradle]] as values of DSL variables. Some of the coordinates, such as [[#Group|group]], [[#Version|version]] and [[#Description|description]] can also be set. The coordinates are also available programmatically via the Project API.


Gradle produces by default artifacts that are compatible with Maven repositories, so Gradle translates its project coordinates to [[Maven_Concepts#Maven_Coordinates|Maven project coordinates]] as follows:
Gradle produces by default artifacts that are compatible with Maven repositories, so Gradle translates its project coordinates to [[Maven_Concepts#Maven_Coordinates|Maven project coordinates]] as described in [[#Name|name]], [[#Group|group]] and [[#Version|version]] sections: the project name becomes [[Maven_Concepts#Artifact_ID|artifactId]]


=Coordinates=
=Coordinates=

Revision as of 01:31, 4 October 2020

Internal

Overview

The project coordinates such as name, group, version, description and path can be read from build.gradle as values of DSL variables. Some of the coordinates, such as group, version and description can also be set. The coordinates are also available programmatically via the Project API.

Gradle produces by default artifacts that are compatible with Maven repositories, so Gradle translates its project coordinates to Maven project coordinates as described in name, group and version sections: the project name becomes artifactId

Coordinates

Name

The project name is a string that identifies the project. The project name is initialized by default with the name of the directory that contains the project's build.gradle.

The name is not necessarily unique within a project hierarchy, the unique identifier for the project in a hierarchy is its path. The project name can be obtained programmatically during the build with Project.getName() or with the name DSL variable:

println "${name}"
println project.name

Group

Version

Description

Path

Project Directory