4

Recent maven versions do colored output in terminal. Git Bash shows correct colors, but ConsoleZ configured to use git bash does not. It just outputs raw color codes. Does anyone know how to fix it

$ mvn clean
[←[1;34mINFO←[m] Scanning for projects...
[←[1;34mINFO←[m]
g6380647
  • 267
  • 1
  • 2
  • 10

3 Answers3

3

On Cygwin, when I pipe the output of Maven to the tee command, it fixes the output so that it displays the actual colored text instead of [←[1;34mINFO←[m] stuff:

./mvnw -pl *-common -pl *jdbc-autoconfig dependency:tree -Dincludes=org.springframework | tee

Lyle Z
  • 1,269
  • 10
  • 7
2

I met the same issue in Window10 with Git Bash in both Console2 and ConsoleZ (try different configuration but it does not work). After a lot of attempt, I decided to give a try to ConEmu. Amazing, it works perfect. I can configure all my prefer behaviors like in ConsoleX, AND the bottom line is maven now can display correctly like in native git bash.

I think you can give a try to ConEmu. This is the configuration for GitBash (it's quite same as ConsoleX)

Settings -> Startup -> Add new (+)

Task parameters

/icon "C:\Program Files\Git\mingw64\share\git\git-for-windows.ico" /dir E:\

Commands

"C:\Program Files\Git\bin\sh.exe" --login -i

Remember to update your paths

Hope this helps.

Quang Nguyen
  • 134
  • 1
  • 6
0

Following up on Lyle Z's answer I'm now using the following alias:

alias mvn="mvn_tee_output"
function mvn_tee_output () {
    "mvn" $@ | tee
} 
jBuchholz
  • 1,742
  • 2
  • 17
  • 25