【发布时间】:2019-12-17 19:00:44
【问题描述】:
我在 Eclipse 中有一个带有 maven 的 Java 项目。这个项目包括几个 Junit5 测试。
我的pom.xml 配置如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<properties>
<configurationParameters>
junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.mode.default = concurrent
</configurationParameters>
</properties>
</configuration>
</plugin>
我包含了我的 junit 依赖项如下:
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.1</version>
<scope>test</scope>
</dependency>
当我在我的项目上单击右键时,我可以选择Run As -> Junit Test。这将打开 Junit 视图,我可以在其中很好地查看过程并在没有我的 maven 设置的情况下执行测试。
当我在我的项目上单击右键时,我还可以选择Run As -> Maven test。这将打开控制台视图,获取我的 Maven 设置并运行测试。但我不喜欢控制台视图的外观。
所以我的问题是:是否可以通过Maven test 执行我的项目以使用我的 maven 设置并让它在 Junit 视图中运行?
【问题讨论】: