简体   繁体   中英

A gradle task command line options

In the section 11.6.3 of the gradle manual page were mentioned that we can use command line option in gradle task.

This information includes the full task path, the task type, possible commandline options and the description of the given task.

But my question is how can we specify the options in task? Could anyone give an example?

Have a look a the following *build.gradle:

apply plugin: 'java'

task lol(type: JavaExec) {}

When gradle -q help --task lol is run the following output occurs:

Detailed task information for lol

Path
     :lol

Type
     JavaExec (org.gradle.api.tasks.JavaExec)

Options
     --debug-jvm     Enable debugging for the process. The process is started suspended and listening on port 5005. [INCUBATING]

Description
     -

So this is how option looks like: --debug-jvm

Here You can find how it's implemented - configuring an Option not an Option itself. org.gradle.api.internal.tasks.options.Option is a part of internal gradle API. And it seems that it's still an incubating feature.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM