英文:
Tests not running with Junit 5 and Maven
问题
我正试图为我的项目运行 Jacoco 测试覆盖率。当我从终端使用命令 mvn clean package
时,测试用例不会运行。但是当我使用 IntelliJ 运行相同的测试时,一切都正常。
我的 Maven 版本是 3.6.3
。以下是 pom.xml
中依赖项和插件的版本:
<maven-failsafe-plugin.version>2.22.1</maven-failsafe-plugin.version>
<maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
<jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
<junit-jupiter.version>5.7.0</junit-jupiter.version>
我正在使用 Spring Boot Starter Parent:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
</parent>
我花了很多时间来尝试找出问题,但没有成功。以下是我尝试过的许多链接中的几个。非常感谢任何帮助。谢谢!
英文:
I am trying to run Jacoco test coverage for my project. When I use the command mvn clean package
from the terminal, the test cases won't run. But when I run the same tests using IntelliJ, everything works fine.
My maven version is 3.6.3
. These are the versions of the dependencies and plugin in the pom.xml
<maven-failsafe-plugin.version>2.22.1</maven-failsafe-plugin.version>
<maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
<jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
<junit-jupiter.version>5.7.0</junit-jupiter.version>
I am using the Springboot starter parent
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
</parent>
I spent an awful amount of time trying to figure out the issue, but no joy. Below are the few of the many links I tried. Any help is greatly appreciated. Thanks!
答案1
得分: 1
我通过将surefire和failsafe插件的版本从2.22.1
更新为3.0.0-M5
来解决了这个问题。
英文:
I was able to resolve the issue by updating the version of the surefire and failsafe plugin to 3.0.0-M5
instead of 2.22.1
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论