Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove colors from Maven output?

Tags:

maven

When I run a maven goal in Jenkins (e.g. "mvn test"), the logs are very hard to read because of the color control characters that appear (see example below). Is there anyway to remove the color formatting?

[[1;34mINFO[m] [1m-------------------------------------------------------------------[m [[1;34mINFO[m] [1;32mBUILD SUCCESS[m [[1;34mINFO[m] [1m-------------------------------------------------------------------[m [[1;34mINFO[m] Total time: 16.097 s [[1;34mINFO[m] Finished at: 2017-04-26T11:23:06-04:00 [[1;34mINFO[m] Final Memory: 41M/100M [[1;34mINFO[m] [1m-------------------------------------------------------------------[m 
like image 447
simbro Avatar asked Apr 26 '17 15:04

simbro


People also ask

How do I Turn Off Colors in Linux terminal?

I do not like colors. How can I turn off color listing in Linux terminal? You can disable all color in your shell. By default, colors are turned on by many commands. The xterm program is a terminal emulator for the X Window System.

How do I remove colors from an image?

It is also possible to adjust the distance to remove similar colors. Select an image, select a color, and click the Remove button. You can select the image format you need, apply the changes and immediately see the result. If it suits you, save the processed image to your device.

How to turn off color in Linux terminal for ls/grep/egrep commands?

Turn off color in Linux terminal for ls/grep/egrep commands. By default, ls command/ grep command /nixcmd name=”egrep”] are aliased as follows: type -a ls. alias ls='ls --color=auto'. You can verify it with the command command or type command as follows: command -V grep. type -a grep.

Is there a way to disable coloring for the entire script?

Maybe there is a way to completely disable coloring for the entire script? Show activity on this post. According to Wikipedia, the [m|K] in the sed command you're using is specifically designed to handle m (the color command) and K (the "erase part of line" command).


1 Answers

Thanks to khmarbaise for his/her answer in the comment to my question:

you can simply define -B for --batch-mode which will turn off using of colors..

This fixed the issue, my output now looks like this (much nicer):

[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 17.507 s [INFO] Finished at: 2017-04-27T05:30:07-04:00 [INFO] Final Memory: 41M/100M [INFO] ------------------------------------------------------------------------ 
like image 91
simbro Avatar answered Oct 17 '22 04:10

simbro