Gradle Command Line: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(24 intermediate revisions by the same user not shown)
Line 4: Line 4:


=Overview=
=Overview=
In case of a multi-project, Gradle command can be executed from the root of the project or from any sub-projects.
Some command line options have the same effect as setting corresponding properties or environment variables. When a command line option is present, it has precedence over the equivalent properties or environment variables. More details in: {{Internal|Gradle_Variables_and_Properties#Command_Line_Flags|Gradle Variables and Properties}}
=Command Line Flags=
=Command Line Flags=
==--q,--quiet==
==<tt>--help</tt>==
In-line help.
<syntaxhighlight lang='bash'>
gradle --help
</syntaxhighlight>
 
==<tt>--version</tt>==
<syntaxhighlight lang='bash'>
./gradlew --version
</syntaxhighlight>
<syntaxhighlight lang='bash'>
gradle --version
</syntaxhighlight>
 
==<tt>--q</tt>,<tt>--quiet</tt>==
Only warning and error category output is displayed. The logger "quiet" category can be accessed with:
Only warning and error category output is displayed. The logger "quiet" category can be accessed with:
<syntaxhighlight lang='groovy'>
<syntaxhighlight lang='groovy'>
Line 11: Line 30:
</syntaxhighlight>
</syntaxhighlight>
Also see: {{Internal|Gradle Logging#Output_Configuration|Gradle Logging}}
Also see: {{Internal|Gradle Logging#Output_Configuration|Gradle Logging}}
==-i,--info==
==<tt>-m</tt>,<tt>--dry-run</tt>==
Executes a [[Gradle_Task#Dry_Run|dry run]]: run the builds with all task actions disabled.
 
==<tt>-i</tt>,<tt>--info</tt>==
When executed with -i, Gradle displays the tasks that are executed, in the order in which they are executed. Additionally, [[#-m.2C--dry-run|-m|--dry-run]] can be used to simulate the execution without actually performing the task actions.
Also see: {{Internal|Gradle Logging#Output_Configuration|Gradle Logging}}
Also see: {{Internal|Gradle Logging#Output_Configuration|Gradle Logging}}
==-d,--debug==
==<tt>-d</tt>,<tt>--debug</tt>==
Also see: {{Internal|Gradle Logging#Output_Configuration|Gradle Logging}}
Also see: {{Internal|Gradle Logging#Output_Configuration|Gradle Logging}}
==-P<property-name>=<property-value> Project Properties==
==<tt>-P<property-name>=<property-value></tt> Project Properties==
See: {{Internal|Gradle_Project_Coordinates,_State_and_Configured_Properties#-P_Command-Line_Options|Gradle Project Coordinates, State and Configured Properties}}
See: {{Internal|Gradle_Project_Coordinates,_State_and_Configured_Properties#-P_Command-Line_Options|Gradle Project Coordinates, State and Configured Properties}}
==-D<property-name>=<property-value> System Properties==
==<tt>-D<property-name>=<property-value></tt> System Properties==
See: {{Internal|Gradle System Properties#Overview|Gradle System Properties}}
See: {{Internal|Gradle System Properties#Overview|Gradle System Properties}}
==-x==
==<span id='-x'></span>-x,--exclude-task==
{{External|https://docs.gradle.org/current/userguide/command_line_interface.html#sec:excluding_tasks_from_the_command_line}}
Execute without the task following -x. For example, if I want to execute a [[Gradle Operations TODEPLETE#Build_without_Tests|build without tests]]:
Execute without the task following -x. For example, if I want to execute a [[Gradle Operations TODEPLETE#Build_without_Tests|build without tests]]:
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
Line 28: Line 52:
gradle build publish -x javadoc
gradle build publish -x javadoc
</syntaxhighlight>
</syntaxhighlight>
==--build-cache==
 
==<tt>--build-cache</tt>==
==<tt>--continue</tt>==
Also see [[Gradle_Task_Dependencies_and_Ordering#continue|Ordering Tasks]].
==<tt>--no-daemon</tt>==
See: {{Internal|Gradle Daemon|Gradle Daemon}}
==<tt>--stop</tt>==
See: {{Internal|Gradle_Daemon_Operations#Stop|Gradle Daemon Operations &#124; Stop}}
==<tt>--status</tt>==
See: {{Internal|Gradle_Daemon_Operations#Status|Gradle Daemon Operations &#124; Status}}
==<tt>--refresh-dependencies</tt>==
{{Internal|Gradle_Dependencies_and_Dependency_Configurations#Forced_Cache_Update|Gradle Dependencies and Dependency Configurations &#124; Forced Cache Update}}
==<tt>--rerun-tasks</tt>==
{{Internal|Gradle_Incremental_Builds#Disable_Incremental_Builds|Disable Incremental Builds}}


=Built-in Tasks=
=Built-in Tasks=
* [[Gradle tasks Task|gradle tasks]]
* [[Gradle tasks Task|gradle tasks]]
* [[Gradle Wrapper Operations|gradle wrapper]]
* [[gradle init|gradle init]]

Latest revision as of 05:18, 13 June 2021

Internal

Overview

In case of a multi-project, Gradle command can be executed from the root of the project or from any sub-projects.

Some command line options have the same effect as setting corresponding properties or environment variables. When a command line option is present, it has precedence over the equivalent properties or environment variables. More details in:

Gradle Variables and Properties

Command Line Flags

--help

In-line help.

gradle --help

--version

./gradlew --version
gradle --version

--q,--quiet

Only warning and error category output is displayed. The logger "quiet" category can be accessed with:

logger.quiet "will be displayed even in quiet mode"

Also see:

Gradle Logging

-m,--dry-run

Executes a dry run: run the builds with all task actions disabled.

-i,--info

When executed with -i, Gradle displays the tasks that are executed, in the order in which they are executed. Additionally, -m|--dry-run can be used to simulate the execution without actually performing the task actions.

Also see:

Gradle Logging

-d,--debug

Also see:

Gradle Logging

-P<property-name>=<property-value> Project Properties

See:

Gradle Project Coordinates, State and Configured Properties

-D<property-name>=<property-value> System Properties

See:

Gradle System Properties

-x,--exclude-task

https://docs.gradle.org/current/userguide/command_line_interface.html#sec:excluding_tasks_from_the_command_line

Execute without the task following -x. For example, if I want to execute a build without tests:

gradle build -x test

or if I want to publish without running the javadoc task:

gradle build publish -x javadoc

--build-cache

--continue

Also see Ordering Tasks.

--no-daemon

See:

Gradle Daemon

--stop

See:

Gradle Daemon Operations | Stop

--status

See:

Gradle Daemon Operations | Status

--refresh-dependencies

Gradle Dependencies and Dependency Configurations | Forced Cache Update

--rerun-tasks

Disable Incremental Builds

Built-in Tasks