如何从Maven输出中删除颜色? [英] How do I remove colors from Maven output?

查看:192
本文介绍了如何从Maven输出中删除颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在詹金斯(Jenkins)中运行Maven目标(例如"mvn测试")时,由于出现了颜色控制字符,因此很难读取日志(请参见下面的示例).反正有没有删除颜色格式?

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

推荐答案

感谢khmarbaise在对我的问题的评论中的回答:

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

您可以简单地为--batch-mode定义-B,它将使用of关闭 颜色..

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] ------------------------------------------------------------------------

这篇关于如何从Maven输出中删除颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆