Gradle Project: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
Line 29: Line 29:
More details on using plugins are available in: {{Internal|Gradle_Plugin_Concepts#Using_a_Plugin|Using a Plugin}}
More details on using plugins are available in: {{Internal|Gradle_Plugin_Concepts#Using_a_Plugin|Using a Plugin}}


<span id='Project_Coordinates_1'></span>The project's coordinates are available through a series of DSL variables: [[Gradle_Project_Coordinates#Name|name]], [[Gradle_Project_Coordinates#Group|group]], [[Gradle_Project_Coordinates#Version|version]], [[Gradle_Project_Coordinates#Description|description]], [[Gradle_Project_Coordinates#Path|path]], etc. Some of the coordinates, such as "group", "version" and "descriptions" can be also set with a variable assignment.  
<span id='Project_Coordinates_1'></span>The project's coordinates are available through a series of DSL variables: [[Gradle_Project_Coordinates_and_State_Properties#Name|name]], [[Gradle_Project_Coordinates_and_State_Properties#Group|group]], [[Gradle_Project_Coordinates_and_State_Properties#Version|version]], [[Gradle_Project_Coordinates_and_State_Properties#Description|description]], [[Gradle_Project_Coordinates_and_State_Properties#Path|path]], etc. Some of the coordinates, such as "group", "version" and "descriptions" can be also set with a variable assignment.  
<syntaxhighlight lang='groovy'>
<syntaxhighlight lang='groovy'>
group = "io.playground"
group = "io.playground"

Revision as of 03:16, 4 October 2020

External

Internal

Overview

A Gradle project typically represents a software component to be built by executing a set of tasks in sequence. A project has a direct class representation in the Gradle domain model: org.gradle.api.Project.

The project instance is available to the build.gradle script via the project variable, which corresponds to the Project.getProject() accessor. The project instance is not available in settings.gradle, only the root project descriptor via rootProject variable, which corresponds to Settings.getRootProject().

Project API and build.gradle DSL

The build script classpath for the project can be configured with Project.buildscript(Closure) which corresponds to the "buildscript" DSL element:

buildscript {
  // configuration closure
}

More details are available in:

Build Script Classpath

Plugins for the build can be declare with PluginAware.apply(...), which corresponds to the "apply" DSL element:

apply plugin:|from: '...'

More details on using plugins are available in:

Using a Plugin

The project's coordinates are available through a series of DSL variables: name, group, version, description, path, etc. Some of the coordinates, such as "group", "version" and "descriptions" can be also set with a variable assignment.

group = "io.playground"
version = "0.1.0"
description = "Example project"
logger.info "Project coordinates: ${group} ${name} ${version} ${description} ${path}"

More details available in:

Gradle Project Coordinates

The project logger is also accessible in build.gradle. For more details see:

Gradle Logging

Dependencies and configurations can be managed with the "dependencies" and "configurations" DSL elements:

dependencies {
  // configuration closure
}
configurations {
  // configuration closure
}

More details in:

Gradle Dependencies and Configurations

Project Coordinates

Gradle Project Coordinates

Multi-Project Builds

Multi-Project Builds

TO DEPLETE

Gradle Project and Build Script