.gradle/init.d/springColorLogging.gradle
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 22 Feb 2017 10:23:40 +0200
changeset 837 4ba0fe28be27
child 838 98cdbead06be
permissions -rw-r--r--
Enable colors for logging in terminal for Windows in mintty for Spring Boot.

gradle.taskGraph.whenReady { graph ->
    // graph.getAllTasks().findAll().each { println it }
    def console = System.console() != null
    if (! console) { console = System.getenv()["TERM"].startsWith("xterm") }
    if (! console) return
    graph.getAllTasks().findAll({it.name.equals("bootRun")}).each {
        it.systemProperties 'spring.output.ansi.enabled': 'always'
        // it.metaClass.methods*.name.sort().unique().each { println it }
    };
    // graph.metaClass.properties.each { println it }
    // graph.metaClass.methods*.name.sort().unique().each { println it }
}