selflearner
selflearner

Reputation: 273

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.

<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?

Thank you

enter image description here

Upvotes: 4

Views: 1529

Answers (2)

Stefan Birkner
Stefan Birkner

Reputation: 24560

You need JUnit 4 if you want to use annotations.

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.12</version>
</dependency>

Upvotes: 2

Tnadev
Tnadev

Reputation: 10112

Do following:

  1. Update maven project.

  2. Clean your project.

And then re run your test

Upvotes: 0

Related Questions