Search code examples
gradle

How do I set test.testLogging.showStandardStreams to true from the command line?


It is convenient to debug some of external libraries and even internal code while writing unit tests by reviewing the logging on stdout.

While I can add test.testLogging.showStandardStreams = true to the build.graddle file, I'd rather do something less permanent, such as setting this flag from the command line execution of gradle.

I've tried several approaches, none seem to work:

gradle test -Dtest.testLogging.showStandardStreams=true
gradle test -Ptest.testLogging.showStandardStreams=true

And other variations of those options by changing the property string. Nothing seems to do the trick.

How do I set test.testLogging.showStandardStreams=true from the command line?


Solution

  • There is no built-in way to set build model properties from the command line. You'll have to make the build script query a system or project property that gets passed in via -D or -P, respectively.