Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Maven be made less verbose?

People also ask

What is logging in Maven?

By default, Maven only logs the info, warning, and error logs. Also, for errors, it doesn't show the full stacktrace of that log. In order to see the full stacktrace, we can use the -e or –errors option: $ mvn -e clean compile // truncated cannot find symbol symbol: variable name location: class Compiled at org.

What is batch mode in Maven?

Sep 17, 2014 at 17:03. 2. Interactive means you need to type some answer in your keyboard and batch mode means no need to type anything maven is assuming defaults as answers.


You can try the -q switch.

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


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


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.


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

You can add in the JVM parameters :

-Dorg.slf4j.simpleLogger.defaultLogLevel=WARN

Beware of UPPERCASE.


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


If you only want to get rid of the [INFO] messages you also could do:

mvn ... | fgrep -v "[INFO]"

To suppress all outputs (except errors) you could redirect stdout to /dev/null with:

mvn ... 1>/dev/null

(This only works if you use bash (or similar shells) to run the Maven commands.)