javagradleexec

Gradle Exec - how to log commandline?


I am using Gradle to build my project. The build file contains several Exec tasks to run external programs (shell scripts and the Java Packager). The build is not always successful and I want to find out why. Analyzing all the output I have it feels strange that Gradle does not print the command that is getting invoked.

How can I make Gradle print the commandline before it starts executing?


Solution

  • You can use log levels of gradle

    whenever you invoke gradle command you can do like this

    ./gradlew mytask --info //info logs
    ./gradlew mytask -s //to get stacktrace 
    

    Ref: https://docs.gradle.org/current/userguide/command_line_interface.html#sec:command_line_logging https://docs.gradle.org/current/userguide/command_line_interface.html#sec:command_line_debugging