7

I'd like to tune down logging during Maven Invoker tests. Right now logs are polluted with sequence of Downloading and Downloaded for every dependency in every test separately.

[INFO] [INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-grouper/2.19/surefire-grouper-2.19.jar
[INFO] [INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-grouper/2.19/surefire-grouper-2.19.jar (38 KB at 1292.5 KB/sec)

I want to preserve all other logs, so mvn -q is not an option. Also, --batch-mode hides just downloading progress, not Downloading and Downloaded logs.

Michal Kordas
  • 10,475
  • 7
  • 58
  • 103
  • did you check couple of answers on http://stackoverflow.com/questions/4782089/how-to-change-maven-logging-level-to-display-only-warning-and-errors for some hints? Short answer to your question would be: it is not possible. It would be possible with scripting on top of Maven (i.e. if your question was mostly about CI builds) – A_Di-Matteo Jan 31 '16 at 21:21
  • You'll only get those logs once. After those dependency are installed in your Maven repo, you won't have them anymore. – Tunaki Jan 31 '16 at 22:31

2 Answers2

8

Adding

-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn

to MAVEN_OPTS should help with that. At least in maven 3.2.3 and 3.3.9 (those were the ones I've tested).

gvlasov
  • 18,638
  • 21
  • 74
  • 110
Krzysztof Krasoń
  • 26,515
  • 16
  • 89
  • 115
  • 1
    right, it helps! But only if `invoker.mavenOpts` are declared before `invoker.goals` in `invoker.properties`. Very strange behavior for me. – Michal Kordas Feb 05 '16 at 21:03
1

If your build is done on an Unix like environment and you can change how Maven is invoked, you can pipe the Maven output to egrep:

mvn <goals> | egrep -v ' Download(ing|ed): '
Joao Morais
  • 1,885
  • 13
  • 20