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

时光怂恿深爱的人放手 提交于 2019-12-18 12:48:11

问题


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]?


回答1:


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




回答2:


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



回答3:


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




回答4:


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



来源:https://stackoverflow.com/questions/4116659/is-is-possible-to-modify-the-maven-console-output-to-hide-the-info-logging

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!