Is there a short hand for gradle debug?

Like maven have mvnDebug vs mvn out of the box.
Does gradle? Rather than set/unset the OPTS everytime ?

> -Dorg.gradle.daemon.debug=true on https://docs.gradle.org/current/userguide/command_line_interface.html?&_ga=2.31264959.1270406471.1517316816-1028277259.1515509640#sec:command_line_debugging does not seem to be a vlid thing to pass on commandline
> 
> PS C:\Users\hoaphan\TestTask> gradle -Dorg.gradle.daemon.debug=true myTask
> 
> FAILURE: Build failed with an exception.
> 
> * What went wrong:
> Task '.gradle.daemon.debug=true' not found in root project 'TestTask'.
> 
> * Try:
> Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
> 
> * Get more help at https://help.gradle.org

I think the doc is wrong, also it does not make much sens to have -D…=true while default is already false. It should be a flag, if it does exist.

Gradle has the property org.gradle.debug. It can be set any way you can set a build property, including command line. Documentation references include command line debugging and gradle configuration properties.

Hold on, can you actually do
gradle -Dorg.gradle.daemon.debug=true myTask

I’m getting:

FAILURE: Build failed with an exception.

* What went wrong:
Task '.gradle.daemon.debug=true' not found in root project 'TestTask'.

* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

you can try using :
gradle myTask --debug

Ah sorry I did before, that is for enablin DEBUG level of the logging, not pause and wait for remote debugger to connect.

Yes, I can run gradle -Dorg.gradle.daemon.debug=true myTask without an error.

I can only reproduce your error if I add an incorrect space between org and gradle so that it reads
gradle -Dorg .gradle.daemon.debug=true myTask
or omit -Dorg entirely, which makes sense to cause that error, but I’m also not on Windows.

However, I also only use gradle -Dorg.gradle.debug=true as it propagates the debug JVM arguments to the correct location for debugging Gradle or a Gradle plugin.

I swear there were no space in my opt :joy:

New photo by Hoa Phan