在Maven中下载工件时详细说明日志

时间:2016-08-29 21:02:58

标签: java maven amazon-s3 dependency-management

运行Maven构建时我的控制台输出被

污染
[INFO] Logged in - repository.hid.com
[INFO] Downloading: s3://repository.hid.com/release/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6.pom
[INFO] Logged off - repository.hid.com
[INFO] Transfers: 1 Time: 43ms Amount: 0 bytes Throughput: 0.000 bytes/s
[INFO] Logged in - repository.hid.com
[INFO] Downloading: s3://repository.hid.com/release/org/slf4j/slf4j-parent/1.7.6/slf4j-parent-1.7.6.pom
[INFO] Logged off - repository.hid.com
[INFO] Transfers: 1 Time: 41ms Amount: 0 bytes Throughput: 0.000 bytes/s
[INFO] Logged in - repository.hid.com
[INFO] Downloading: s3://repository.hid.com/release/com/jcraft/jsch/0.1.42/jsch-0.1.42.pom
[INFO] Logged off - repository.hid.com

settings.xml中,此存储库配置为

<server>
  <id>repository.hid.com</id>
  <username>usr</username>
  <password>pwd</password>
</server>

然后在pom.xml

 <repository>
    <id>repository.hid.com</id>
    <url>s3://repository.hid.com/release</url>
</repository>

是否可以删除Logged inLogged off消息,或者至少为每个工件只建立一个连接?

1 个答案:

答案 0 :(得分:1)

You need to find out the logger name and then set the logger to error

Find the logger instance

In the file <MAVEN_HOME>/conf/logging/simplelogger.properties. Change org.slf4j.simpleLogger.showLogName=true Find the logger which logs Logged in and Logged off

disable info logs for the logger instance

If logger instance is org.apache.maven.x.y.z then set org.slf4j.simpleLogger.log.org.apache.maven.x.y.z = error

this should not log info logs for that logger instance