问题描述
我正在尝试使用两个构建配置文件设置 Maven 构建
- 一个带有 junit-jupiter (JUnit 5)
- 带有junit-vintage 的(Junit 4)
默认配置文件使用 junit-jupiter-engigne 并按预期工作,但 Vintage 配置文件(使用 unit-vintage-engine)不会发现任何测试...
默认配置文件,只需运行maven:mvn test
老式配置文件,使用属性运行 maven:mvn test -Dtest=vintage
在这个只包含一个类和两个 junit 测试(一个 junit-jupiter 和一个 junit (v 4.13.1))的简单项目中,谁能看出配置有什么问题? https://github.com/jactor-rises/junit-profiles
注意!
主分支不包含任何代码。
有两种实现,见分支:feature/java
和 feature/kotlin
解决方法
您不能将名称为“test”的属性与 Thread graph= new Thread(mat_lib.function_plot);
graph.Start();
一起使用来激活配置文件,因为 it's predefined for running a single test。
将其重命名为其他名称。
此外,您可以使用 maven-surefire-plugin
代替:-P
。