Search code examples
kotlingradlegradle-kotlin-dsl

Disable Gradle "Executing" Messages


I am building a simple Kotlin application that gets user input then prints it to the screen:

while (true) {
    val PROMPT = ">>> "

    print(PROMPT)
    val userInput = readLn()

    println(userInput)
}

But whenever I run this application using ./gradlew run, I get these messages:

<========---> 80% EXECUTING [2m 30s]
>>> ===---> 80% EXECUTING [2m 31s]
<==========---> 80% EXECUTING [2m 34s]

Here's what I tried to remove them:

In my build.gradle.kts file:

tasks.named<JavaExec>("run") {
    standardInput = System.`in`
    standardOutput = System.out
    logging.captureStandardOutput(LogLevel.QUIET)
    logging.captureStandardError(LogLevel.QUIET)
}

I have also tried changing the LogLevel to LogLevel.ERROR for both captureStandardOutput and captureStandardError, yet I still get these "Executing" messages


Solution

  • Try to run Gradle in cmd with the following tags:

    For example:

    ./gradlew -q --console=plain run
    

    But when I tested these flags, I ran into a problem: Gradle doesn't print text message to console without newline character before user prompt, i.e. the print("smt") method has no effect, but the println("smt") method works fine. I don't know why this is happening.