Can Maven be made less verbose?

后端 未结 8 2114
遥遥无期
遥遥无期 2020-12-13 08:42

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

相关标签:
8条回答
  • 2020-12-13 08:55

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

    You can add in the JVM parameters :

    -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN
    

    Beware of UPPERCASE.

    0 讨论(0)
  • 2020-12-13 08:55

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

    0 讨论(0)
  • 2020-12-13 08:59

    You can try the -q switch.

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

    0 讨论(0)
  • 2020-12-13 09:06

    Maven 3.1.x uses SLF4j for logging, you can find instructions how to configure it at https://maven.apache.org/maven-logging.html

    In short: Either modify ${MAVEN_HOME}/conf/logging/simplelogger.properties, or set the same properties via the MAVEN_OPTS environment variable.

    For example: setting MAVEN_OPTS to -Dorg.slf4j.simpleLogger.log.org.apache.maven.cl‌​i.transfer.Slf4jMave‌​nTransferListener=wa‌​rn configures the logging of the batch mode transfer listener, and -Dorg.slf4j.simpleLogger.defaultLogLevel=warn sets the default log level.

    0 讨论(0)
  • 2020-12-13 09:08

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

    0 讨论(0)
  • 2020-12-13 09:13

    The existing answer help you filter based on the log-level using --quiet. I found that many INFO messages are useful for debugging, however the downloading artifact log messages such as the following were noisy and not helpful.

    Downloading: http://nexus:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml
    

    I found this solution:

    https://blogs.itemis.com/en/in-a-nutshell-removing-artifact-messages-from-maven-log-output

    mvn clean install -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
    
    0 讨论(0)
提交回复
热议问题