我正在使用maven来运行我的测试。当测试运行时,对于输出到控制台的消息有很多无用的东西(至少对我来说)。我的pom.xml具有以下插件配置。如何关闭或压缩邮件测试加载邮件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<includes>
<include>**/*Tests.java</include>
</includes>
<systemPropertyVariables>
<log4j.configuration>file:${project.build.testOutputDirectory}/log4j.properties</log4j.configuration>
</systemPropertyVariables>
</configuration>
</plugin>
当我运行
mvn clean test
我看到一堆看起来像以下消息。
[parsing started RegularFileObject[...]]
[search path for source files: ...]
[search path for class files: ...]
[loading ZipFileIndexFileObject[...]]
如何关闭这些功能?
我没有做任何System.out.print的。它似乎是这些消息是从Maven surefire插件输出,当它扫描类和罐子运行测试。但我必须同意,它们似乎是System.out.print消息,因为它们的输出与log4j.properties或logback.xml中定义的内容不相似。顺便说一下,我试图把这个log4j.xml文件放到我的src/test/resources文件夹中,但这没有帮助。现在我不得不怀疑,如果这是真的,他们为什么要使用System.out.println以及为什么这样看起来毫无用处的消息。 –
好吧,我只是发现那些消息可以由“javac -verbose”生成。我根据http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html关闭了它,现在这些输出消失了。 –
Goot知道你已经解决了它。我认为在这里作出回答并接受它是值得的,所以其他人看到了正确的答案。 –