purrduc
purrduc

Reputation: 135

Set command line parameter in build.gradle

One of the gradle tasks I'm running is doing too many printouts and since I can't adjust its inner log level I'm trying to run it with the -q command line option to restrict the printout to error level only. That works fine but I also need to run the task when I don't have access to the command line (like from inside IntelliJ and when running other tasks that are depending on it.) Is there a way that I can specify in build.gradle that this task should always be run with -q?

Upvotes: 2

Views: 824

Answers (2)

ToYonos
ToYonos

Reputation: 16833

You can set a global log level in gradle.properties

org.gradle.logging.level=(quiet,warn,lifecycle,info,debug)

When set to quiet, warn, lifecycle, info, or debug, Gradle will use this log level. The values are not case sensitive. The lifecycle level is the default. See Choosing a log level.

It's not possible to reduce the scope to the task level but at least for test purpose, it will work.

Upvotes: 1

Stanislav
Stanislav

Reputation: 28106

It seems, that it's not possible to do it now for a single task - there is an open issue for supporting such a case, which is still open.

Upvotes: 1

Related Questions