Is is possible to modify the maven console output to hide the [INFO] logging?

前端 未结 4 776
一生所求
一生所求 2020-12-30 19:24

I was wondering if it was possible to modify the output from maven to for example hide the lines that start with [INFO] or to be able to see lines that start with [DEBUG]?

相关标签:
4条回答
  • 2020-12-30 19:33

    try grepping the output, e.g. mvn help:evaluate -Dexpression=project.version | grep -v "^\["

    0 讨论(0)
  • 2020-12-30 19:35

    I don't think there is a way to configure it as a logger but mvn -q hides the [INFO] lines and mvn -X shows the debug messages.

    Update in 2015: newer versions of maven have added a config file where this is finally possible although as a global per install configuration, check on your $mavenInstallationDir/conf/logging/simplelogger.properties if the file doesn't exist then your maven version is probably too old, I believe it was added on the 3.1 release

    0 讨论(0)
  • 2020-12-30 19:47

    You can activate debug output using -X or --debug. For example:

    mvn -X install
    

    You can hide INFO messages using -q or --quiet. For example:

    mvn -q install
    
    0 讨论(0)
  • 2020-12-30 19:55

    From their own docs, you want this:

    RESULT=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
    echo $RESULT
    

    For reference, see: https://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html#forceStdout

    0 讨论(0)
提交回复
热议问题