Gradle Operations TODEPLETE: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 20: Line 20:
* [[Build.gradle#Overview|build.gradle]]
* [[Build.gradle#Overview|build.gradle]]
* [[settings.gradle#Overview|settings.gradle]]
* [[settings.gradle#Overview|settings.gradle]]
* a project-level [[Gradle_Concepts#Project-Level_.27gradle.27_Directory|gradle directory]]
* a project-level [[Gradle_Concepts_ToDeplete#Project-Level_.27gradle.27_Directory|gradle directory]]
* a project-level [[Gradle_Concepts#Project-Level_.27.gradle.27_Directory|.gradle]] directory
* a project-level [[Gradle_Concepts_ToDeplete#Project-Level_.27.gradle.27_Directory|.gradle]] directory
* [[Gradle_Concepts#The_Gradle_Wrapper|gradlew]], [[Gradle_Concepts#The_Gradle_Wrapper|gradlew.bat]]
* [[Gradle_Concepts_ToDeplete#The_Gradle_Wrapper|gradlew]], [[Gradle_Concepts_ToDeplete#The_Gradle_Wrapper|gradlew.bat]]


==List Sub-Projects==
==List Sub-Projects==
Line 32: Line 32:
{{External|https://docs.gradle.org/current/userguide/inspecting_dependencies.html}}
{{External|https://docs.gradle.org/current/userguide/inspecting_dependencies.html}}


The full graph of the project's [[Gradle_Concepts#Dependency|dependencies]] can be rendered. The [[#Identify_Why_a_Specific_Dependency_was_Selected|selection reason and origin for a dependency]] can also be displayed.
The full graph of the project's [[Gradle_Concepts_ToDeplete#Dependency|dependencies]] can be rendered. The [[#Identify_Why_a_Specific_Dependency_was_Selected|selection reason and origin for a dependency]] can also be displayed.


To display the dependency trees for all [[Gradle_Concepts#Dependency_Configuration|dependency configurations]] of the project, execute:
To display the dependency trees for all [[Gradle_Concepts_ToDeplete#Dependency_Configuration|dependency configurations]] of the project, execute:


  gradle -q dependencies
  gradle -q dependencies
Line 40: Line 40:
The result is called a ''dependency report''. Any dependency that could not be resolved is marked with FAILED in red color. Dependencies with the same coordinates that can occur multiple times in the graph are omitted and indicated by an asterisk. Dependencies that had to undergo conflict resolution render the requested and selected version separated by a right arrow character. The dependency report provides the raw list of dependencies but does not explain why they have been selected or which dependency is responsible for pulling them into the graph. These explanations can though be generated, see [[#Identify_Why_a_Specific_Dependency_was_Selected|Identify Why a Specific Dependency was Selected]].
The result is called a ''dependency report''. Any dependency that could not be resolved is marked with FAILED in red color. Dependencies with the same coordinates that can occur multiple times in the graph are omitted and indicated by an asterisk. Dependencies that had to undergo conflict resolution render the requested and selected version separated by a right arrow character. The dependency report provides the raw list of dependencies but does not explain why they have been selected or which dependency is responsible for pulling them into the graph. These explanations can though be generated, see [[#Identify_Why_a_Specific_Dependency_was_Selected|Identify Why a Specific Dependency was Selected]].


To display the dependency tree for just one [[Gradle_Concepts#Dependency_Configuration|dependency configuration]]:
To display the dependency tree for just one [[Gradle_Concepts_ToDeplete#Dependency_Configuration|dependency configuration]]:


  gradle -q dependencies --configuration <configuration-name>
  gradle -q dependencies --configuration <configuration-name>
Line 75: Line 75:
  gradle build -x :''some-project'':test
  gradle build -x :''some-project'':test


Build a [[Gradle_Concepts#Sub-Project|sub-project]]:
Build a [[Gradle_Concepts_ToDeplete#Sub-Project|sub-project]]:


  gradle :<''sub-project-name''>:build
  gradle :<''sub-project-name''>:build

Revision as of 17:41, 17 May 2018

Internal

Overview

General Command Line Options

-q

Quiet.

Operations

Start a Project

gradle init

Creates a project structure that includes:

List Sub-Projects

gradle projects

Inspect Dependencies

https://docs.gradle.org/current/userguide/inspecting_dependencies.html

The full graph of the project's dependencies can be rendered. The selection reason and origin for a dependency can also be displayed.

To display the dependency trees for all dependency configurations of the project, execute:

gradle -q dependencies

The result is called a dependency report. Any dependency that could not be resolved is marked with FAILED in red color. Dependencies with the same coordinates that can occur multiple times in the graph are omitted and indicated by an asterisk. Dependencies that had to undergo conflict resolution render the requested and selected version separated by a right arrow character. The dependency report provides the raw list of dependencies but does not explain why they have been selected or which dependency is responsible for pulling them into the graph. These explanations can though be generated, see Identify Why a Specific Dependency was Selected.

To display the dependency tree for just one dependency configuration:

gradle -q dependencies --configuration <configuration-name>

Identify Why a Specific Dependency was Selected

gradle -q dependencyInsight --dependency <dependency-name> [--configuration <configuration-name>]

Print the Runtime Classpath

task printClasspath {
        doLast {
            configurations.runtimeClasspath.each { print it; print ':' }
        }
}

Artifact Publishing Operations

Artifact Publishing Operations

Command-Line Interface

https://docs.gradle.org/current/userguide/command_line_interface.html

Tasks

build

Build without tests:

gradle build -x test
gradle build -x :some-project:test

Build a sub-project:

gradle :<sub-project-name>:build

projects

gradle projects

tasks

gradle <project-path>:tasks
gradle :module1:tasks

properties

Displays project properties, properties added by various plugins and their default values.

gradle properties