How to see color Ant output in MSYS/Git Bash?

*爱你&永不变心* 提交于 2019-11-30 19:37:35

After much Googling and experimentation, I combined several variations into a solution that works well for the particular combination of Git Bash, Ant and Windows.

Relaunch Git Bash after adding the following lines to your .bashrc file:

alias ant='cant'
function cant {
  "ant" -logger org.apache.tools.ant.listener.AnsiColorLogger "$@" \
      2>&1 | perl -pe 's/(?<=\e\[)2;//g'
}

Git Bash Noob Tip: .bashrc file, if it exists, lives in your home directory. Here's how to create/edit it:

$ cd
$ notepad .bashrc &

it's probably even easier to just set the environment variable ANT_ARGS. e.g. just put this in your .bashrc:

export ANT_ARGS='-logger org.apache.tools.ant.listener.AnsiColorLogger'
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!