【发布时间】:2019-02-07 06:19:23
【问题描述】:
我有一个 maven 项目,它有以下 pom
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.7</version>
<type>jar</type>
</dependency>
</dependencies>
以及下面提到的maven-compiler-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
每当我构建我的项目时,由于 maven-compiler-plugin ,Junit 4.12 版本会被安装。
问题
我不想配置 Junit 4.12,因为测试与 Junit 4.12 并行运行,这是我不想要的。
【问题讨论】:
-
单元测试应该相互隔离,这意味着并行运行不会造成任何伤害。如果您的单元测试不满足此条件,您应该重新考虑您的设计,而不是寻找解决方法...