2

当我运行 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

4 回答 4

3

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

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

于 2013-01-23T21:54:59.080 回答
2

你能检查JDK_HOME/jre/lib/logging.properties你的JDK文件夹下的文件吗?maven 中的 guice 使用 java.util.logging,如果您指定了类似的文件,它可以使用 java.util.logging 打开一个或多个记录器。

于 2013-01-28T21:05:51.653 回答
1

答案是我的 JAVA_HOME 指向的是 JDK 安装而不是 JRE 安装……这对我来说毫无意义,但它现在可以工作了。

我编辑了 mvn 命令脚本以回显它运行 java 的位置。从 .../Java/jdk1.6.0_31/bin 运行时,我会收到所有这些错误,但从 .../Java/jre6/bin 运行时,我不会。

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

于 2013-01-28T20:51:31.530 回答
0

由于--show-version记录到

在不停止构建的情况下显示版本信息

我相信这些信息不知何故来自 pom.xml 文件、配置错误的 settings.xml 文件或内部的调试设置MAVEN_HOME

于 2013-01-23T21:54:39.060 回答