Monday 26 October 2015

package org.junit does not exist

package org.junit does not exist

Your Test class might be located in src/main/java.
Also the value of the "scope" element in the POM for JUnit was "test", although that is how it is supposed to be.
The problem was that You had been sloppy when creating the test class in Eclipse that is
resulting in it being created in src/main/java insted of src/test/java.

So put your .java class in src/test/java


And in pom.xml just add  <scope>test</scope> for junit dependency if it is already existed.


<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.11</version>
  <scope>test</scope>
</dependency>

No comments:

Post a Comment