maven - 使用 maven 项目配置 junit
问题描述
我有一个 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 并行运行,这是我不想要的。
解决方案
我无法重现你的情况。maven-compiler-plugin 在依赖项中没有 junit。因为它,你不可能得到 Junit 4.12。
跑去mvn dependency:tree
看看你在哪里得到它。
推荐阅读
- ibm-midrange - 如何使用 CPYFRMSTMF 命令将源代码放入 QRPGLESRC 文件
- python - ModuleNotFoundError:在 os.execv 调用中没有名为“模块名称”的模块 - python
- python - Python日志记录模块,日志文件问题:PermissionError:[WinError 32]进程无法访问该文件,因为它正在被另一个进程使用
- javascript - 如何使用 javascript 填充由 Django 创建的 HTML 表?
- arrays - 递归和数组 - 基本情况 - 长度等于 0 或 1
- javascript - 无法读取未定义的属性“getAboutInfo”
- flutter - 构建函数返回 null Flutter
- c# - 在没有端口转发的情况下通过 TCP 连接?
- java - 如何在 java 中测试 Woocommerce webhook
- firebase - 为什么 BigQuery 将 Firebase user_property 转换为 int?