maven输出大量“精细”日志消息,我该如何阻止它?

时间:2013-01-23 20:44:02

标签: maven maven-3

当我运行maven时,我得到输出,好像我已经指定了日志级别FINE,这使得很难找到实际的输出。我还列出了数百行列出显式和隐式绑定。据我所知,我根本没有配置mvn。我是从cygwin shell中运行的。

以下示例还提供了有关我的版本等信息。

$ mvn --show-version
Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: C:\apache-maven-3.0.4
Java version: 1.6.0_31, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_31\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Module execution: 344ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: TypeListeners & ProvisionListener creation: 6ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Scopes creation: 4ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Converters creation: 1ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Binding creation: 23ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Private environment creation: 1ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Injector construction: 0ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Binding initialization: 20ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Binding indexing: 1ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Collecting injection requests: 0ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Binding validation: 1ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Static validation: 0ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Instance member validation: 5ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Provider verification: 2ms
Jan 23, 2013 3:33:03 PM com.google.inject.internal.util.Stopwatch resetAndLog
FINE: Static member injection: 0ms
Jan 23, 2013 3:33:03 PM org.sonatype.guice.bean.reflect.Logs$JULSink debug
FINE: Add publisher: com.google.inject.internal.InjectorImpl@561777b1

-----[explicit bindings]-------------------------------------------------------
0. ProviderInstanceBinding{key=Key[type=com.google.inject.Injector, annotation=[none]], source=[unknown source], scope=Scopes.NO_SCOPE, provider=Provider<Injector>}
1. ProviderInstanceBinding{key=Key[type=java.util.logging.Logger, annotation=[none]], source=[unknown source], scope=Scopes.NO_SCOPE, provider=Provider<Logger>}
2. InstanceBinding{key=Key[type=com.google.inject.Stage, annotation=[none]], source=[unknown source], instance=DEVELOPMENT}
.
.
.
194. ConstructorBinding{key=Key[type=org.apache.maven.lifecycle.internal.ThreadConfigurationService, annotation=[none]], source=ClassRealm[plexus.core, parent: null], scope=Scopes.SINGLETON}
195. ConstructorBinding{key=Key[type=org.apache.maven.lifecycle.internal.MojoExecutor, annotation=[none]], source=ClassRealm[plexus.core, parent: null], scope=Scopes.SINGLETON}
196. ConstructorBinding{key=Key[type=org.apache.maven.lifecycle.internal.LifecycleThreadedBuilder, annotation=[none]], source=ClassRealm[plexus.core, parent: null], scope=Scopes.SINGLETON}
197. ConstructorBinding{key=Key[type=org.apache.maven.lifecycle.Lifecycle, annotation=[none]], source=ClassRealm[plexus.core, parent: null], scope=Scopes.SINGLETON}

4 个答案:

答案 0 :(得分:3)

它看起来更像是日志输出而不是Maven生成的任何内容。查看Stopwatch class的源代码,它使用的是Java Util Logging。您是否设置了默认日志记录属性以包含FINE级别的输出?这可能在JAVA_HOME本身。

但是,这更像是你如何配置日志而不是Maven所做的任何事情

答案 1 :(得分:2)

您可以检查JDK文件夹下的文件JDK_HOME/jre/lib/logging.properties吗? maven中的guice使用java.util.logging,如果你有指定的文件,它可以使用java.util.logging打开logger或logger。

答案 2 :(得分:1)

答案是我的JAVA_HOME指向JDK安装而不是JRE安装......这对我来说没有意义,但它现在有效。

我编辑了mvn命令脚本来回显它运行java的位置。从何时开始运行  ... / Java / jdk1.6.0_31 / bin我会在运行时遇到所有这些错误  ... / Java / jre6 / bin我不会。

我猜jdk假设更多调试......或者其他什么?我以前从未见过这样的行为。

答案 3 :(得分:0)

由于--show-version被记录为

  

显示不停止构建的版本信息

我认为此信息以某种方式来自pom.xml文件,配置错误的settings.xml文件或调试设置位于MAVEN_HOME内。