简体   繁体   English

Eclipse抱怨丢失Junit jar,即使它已经在构建路径中

[英]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: 做以下事项:

  1. Update maven project. 更新maven项目。

  2. Clean your project. 清理您的项目。

And then re run your test 然后重新运行测试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使用户库containg jar文件位于java构建路径中,eclipse中也没有找到类异常 - class not found exception in eclipse even though the user library containg jar file is in java build path Eclipse Jar构建路径 - Eclipse Jar Build Path classpath缺少jar文件,即使指定了 - classpath missing jar file even though specified ClassNotFoundException,即使包含JAR是构建的一部分 - ClassNotFoundException, even though the containing JAR is part of the build 即使在 jar 中可用,也找不到 Eclipse Java 构建路径 Jar 库类 - Eclipse Java Build Path Jar Library classes not found even if available in jar 在GWT应用程序中使用jdbc连接到mysql(xampp)时遇到问题-即使jar在构建路径中也找不到类 - Having trouble connecting to mysql (xampp) with jdbc in a GWT app - class not found even though jar is in build path 带有jdk11的Eclipse 2018-09声称即使org.junit包也被maven所缺少 - Eclipse 2018-09 with jdk11 claims that package org.junit is missing even though it is included by maven 未找到 JavaFX 控制模块,即使我将其包含在构建路径中(eclipse IDE) - JavaFX controls module not found, even though I included it in the build path (eclipse IDE) Eclipse中缺少构建路径条目 - Build path entry is missing in eclipse Java构建路径中缺少.jar,路径中存在回退 - Missing .jar in Java Build Path with backslaches in path
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM