Can Maven be made less verbose?

53,038

Solution 1

You can try the -q switch.

-q,--quiet Quiet output - only show errors

Solution 2

-q as said above is what you need. An alternative could be:

-B,--batch-mode Run in non-interactive (batch) mode Batch mode is essential if you need to run Maven in a non-interactive, continuous integration environment. When running in non-interactive mode, Maven will never stop to accept input from the user. Instead, it will use sensible default values when it requires input.

And will also reduce the output messages more or less to the essentials.

Solution 3

My problem is that -q is too quiet. I'm running maven under CI

With Maven 3.6.1 (April 2019), you now have an option to suppress the transfer progress when downloading/uploading in interactive mode.

mvn --no-transfer-progress ....

or in short:

mvn -ntp ... ....

That is what Ray proposed in the comments with MNG-6605 and PR 239.

Solution 4

Official link : https://maven.apache.org/maven-logging.html

You can add in the JVM parameters :

-Dorg.slf4j.simpleLogger.defaultLogLevel=WARN

Beware of UPPERCASE.

Solution 5

Use the -q or --quiet command-line options

Share:
53,038
Asaf Bartov
Author by

Asaf Bartov

In a past life, I hacked C, Perl and Ruby on Windows and all Unixen for fun and profit. I did C++ strictly for profit, and under protest. Now I only do software as a hobby, so I get to only use Ruby and JavaScript, whee! :) I run Project Ben-Yehuda, and I work for the Wikimedia Foundation. My code is on GitHub: https://github.com/abartov

Updated on August 30, 2020

Comments

  • Asaf Bartov
    Asaf Bartov almost 4 years

    Maven spews out far too many lines of output to my taste (I like the Unix way: no news is good news).

    I want to get rid of all [INFO] lines, but I couldn't find any mention of an argument or config settings that controls the verbosity of Maven.

    Is there no LOG4J-like way to set the log level?

  • codeturner
    codeturner about 11 years
    @sheki: To clarify, this option does not disable logger debug messages - you need turn that off via your logger settings. For example, if you're using logback, including a src/test/resources/logback-test.xml file in your project will let you customize your logging level to 'off' during the test phase. This will clean everything up.
  • Guss
    Guss almost 8 years
    My problem is that -q is too quiet. I'm running maven under CI, and I want to see the steps it takes (to track progress), but the download indicators are making mess of the non-ANSI display. Is there a way to only turn off the download progress indicators?
  • ankon
    ankon over 7 years
    @Guss: If you only want the Downloading/Downloaded messages to go away, use -B to enable batch mode (you should have that in your CI system anyways!), and then set MAVEN_OPTS="-Dorg.slf4j.simpleLogger.log.org.apache.maven.cl‌​i.transfer.Slf4jMave‌​nTransferListener=wa‌​rn" to kill the progress information for the downloads.
  • Auke
    Auke over 6 years
    In maven 3.5.x I actually need to enable --batch-mode (-B) for the -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.S‌​lf4jMavenTransferLis‌​tener=warn trick to work.
  • Stanislav
    Stanislav over 6 years
    it is used for non-interactive mode, which helps when automating runs
  • Ray
    Ray about 5 years
    if you are inclined I've submitted a proposed solution compatible with interactive mode issues.apache.org/jira/browse/MNG-6605 , github.com/apache/maven/pull/239
  • user1511417
    user1511417 about 4 years
    -q kind of works here (mvn 3.6.0, java 11.0.6) . Unfortunately I still get warnings like this: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.inject.internal.cglib.core. etc.
  • Hilikus
    Hilikus about 4 years
    This solution suppresses upload messages as well as downloads, which is usually not desired in a deploy task