I figured out the issue. If you execute gradle --help- you may notice the --console option in the options list which is responsible for output during gradle task execution. Since gradle v4.0 console option is set to rich by default which causes the output I get using terminal. Basically using --console=plain fixes the issue (for example: gradle --console=plain build).