[英]Eclipse complaining of missing Junit jar even though it is already in build path
I have the below Maven/Eclipse setup and I have already added junit as a compile time dependency in pom.xml. 我有以下Maven / Eclipse设置,我已经在pom.xml中添加了junit作为编译时依赖项。
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
</dependency>
Can anyone clarify why I am being prompted by Eclipse to add junit to build path? 任何人都可以澄清为什么我被Eclipse提示添加junit来构建路径?
Thank you 谢谢
You need JUnit 4 if you want to use annotations. 如果要使用注释,则需要JUnit 4。
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
Do following: 做以下事项:
Update maven project. 更新maven项目。
Clean your project. 清理您的项目。
And then re run your test 然后重新运行测试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.