api / org.gradle.tooling / LongRunningOperation / withArguments

withArguments

abstract fun withArguments(vararg arguments: String): LongRunningOperation

Specify the command line build arguments. Useful mostly for running tasks via BuildLauncher.

Be aware that not all of the Gradle command line options are supported! Only the build arguments that configure the build execution are supported. They are modelled in the Gradle API via org.gradle.StartParameter. Examples of supported build arguments: '--info', '-u', '-p'. The command line instructions that are actually separate commands (like '-?' and '-v') are not supported. Some other instructions like '--daemon' are also not supported - the tooling API always runs with the daemon.

If an unknown or unsupported command line option is specified, org.gradle.tooling.exceptions.UnsupportedBuildArgumentException will be thrown at the time the operation is executed via BuildLauncher#run() or ModelBuilder#get().

For the list of all Gradle command line options please refer to the user guide or take a look at the output of the 'gradle -?' command. Majority of arguments modeled by org.gradle.StartParameter are supported.

The arguments can potentially override some other settings you have configured. For example, the project directory or Gradle user home directory that are configured in the GradleConnector. Also, the task names configured by BuildLauncher#forTasks(String...) can be overridden if you happen to specify other tasks via the build arguments.

See the example in the docs for BuildLauncher If not configured, null, or an empty array is passed, then the reasonable default will be used.

Requires Gradle 1.0 or later.

Parameters

arguments - Gradle command line arguments

Return
this

Since
1.0

abstract fun withArguments(arguments: MutableIterable<String>): LongRunningOperation

Specify the command line build arguments. Useful mostly for running tasks via BuildLauncher.

If not configured, null, or an empty list is passed, then the reasonable default will be used.

Requires Gradle 1.0 or later.

Parameters

arguments - Gradle command line arguments

Return
this

Since
2.6