Gradle Project Coordinates, State and Configured Properties
Internal
Overview
Some of the project coordinates name, group, version and description can be set in settings.gradle and some in build.gradle, read from both [[settings.yaml
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 in build.gradle. The coordinates are also available programmatically via the Project API.
Compatibility with Maven Project Coordinates
Gradle produces by default artifacts that are compatible with Maven repositories, so Gradle translates its project coordinates into Maven project coordinates. The translation rules are described in the name, group and version sections: the project name becomes [[1]],
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
Maven artifactId
The project name automatically becomes the Maven project name coordinate, artifactId.
More details about artifactId:
Group
Maven groupId
The group information must be specified when generating a Maven artifact. If the group information is missing, Maven Publish plugin will complain that "groupId cannot be empty".
Version
Maven version
If the project does not configure a version, the corresponding Maven version will be empty - the artifact will not cary any version information.
Description
Path
Project Directory
TODO
- Verify that name, group and version can be set in settings.gradle. How? Via the ProjectDescriptor interface.