Get clean machine-friendly Maven lines/xml/json output parseable by scripts in STDOUT?

前端 未结 2 1502
南旧
南旧 2021-01-21 14:23

For example, run this command with for a maven project:

mvn dependency:list

What I need from Maven is only these two lines (cut out fr

2条回答
  •  温柔的废话
    2021-01-21 14:54

    Maven uses standard slf4j logging, wrapped in a plexus container. https://maven.apache.org/maven-logging.html

    You should be able to configure the slf4j bindings to provide different output formats as detailed here http://logback.qos.ch/manual/layouts.html#log4jXMLLayout

    I'm not familiar with the cleanlines and json logging formats; however, slf4j is probably one of the more adaptable logging packages, so look around for a Formatter and you have a chance at finding one. However, if you don't the last link above also covers the pages on how to write your own logging layout.

提交回复
热议问题