2

When I run a Maven command, it's normal in the terminal. But there is a problem when I redirect the output to a file like this:

mvn install > file.log

When I open the file, I see:

[[1;34mINFO[m] Scanning for projects...
[[1;34mINFO[m] 
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m

Does anyone know what the problem is? My Ubuntu is 17.10.

Zanna
  • 69,223
  • 56
  • 216
  • 327
Roknauta
  • 290
  • 3
  • 15
  • 1
    The program `mvn`, whatever it is, wants to colorize its output and seems to do this even if standard output is not a terminal. Look for an option to disable colorizing the output. – AlexP Dec 05 '17 at 12:10
  • They look like ANSI color codes - have you tried running in batch (`-B`) mode as described here [Maven CLI Options Reference](http://maven.apache.org/ref/3.5.0/maven-embedder/cli.html) ? – steeldriver Dec 05 '17 at 12:10
  • @AlexP thanks, you're righth. If you want response. – Roknauta Dec 05 '17 at 12:26
  • 1
    @AlexP put the -B in your response. – Roknauta Dec 05 '17 at 12:44

1 Answers1

4

The program mvn, whatever it is, wants to colorize its output and seems to do this even if standard output is not a terminal. Look for an option to disable colorizing the output.

Hat tip to @Douglas: it appears that the required option is mvn -B.

AlexP
  • 10,037
  • 1
  • 32
  • 39