Created
May 3, 2018 15:03
-
-
Save eriwen/c8efa12bcd27a36b499b09e9428868cf to your computer and use it in GitHub Desktop.
Fix stderr in plain console in Gradle 4.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rootProject { | |
def errorFile = file("${rootProject.buildDir}/errors.log") | |
def errorListener = new ErrorCapture(errorFile) | |
allprojects { | |
logging.addStandardErrorListener(errorListener) | |
tasks.all { | |
logging.addStandardErrorListener(errorListener) | |
} | |
} | |
} | |
class ErrorCapture implements StandardOutputListener { | |
private final File errorFile | |
ErrorCapture(File errorFile) { | |
this.errorFile = errorFile | |
errorFile.parentFile.mkdirs() | |
} | |
void onOutput(CharSequence output) { | |
errorFile << output | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment