Maven 在控制台中显示 System.Out

0x4*_*x45 2 java junit maven

我已经用 Java (JUnit) 编写了一个测试用例,当我使用 maven (mvn test) 运行测试时,我的 System.Out.Println 将不会显示在控制台中。有没有任何解决方案,或者这是否可能,因为我在网上没有找到任何内容。

Cà *_*đen 5

尝试通过以下方式运行测试:

mvn test -Dsurefire.useFile=false
Run Code Online (Sandbox Code Playgroud)

或者将其添加到pom.xml

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${surefire-version)</version>
    <configuration>
        <useFile>false</useFile>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

来自文档

使用文件

可以选择生成文件测试报告或仅将测试报告输出到控制台。

类型:布尔值

必需: 否

用户属性:surefire.useFile

默认值:true