Ivan
Ivan

Reputation: 1

JUnit dependency not available in Maven project

I have already rebuilt the Maven repository, but my Maven still does not see JUnit:

I have already rebuilt the Maven repository, but my Maven still does not see JUnit

I use Eclipse IDE, Tried reinstalling the library also manually installed maven, Replaced part of the code in pom, does anyone know how to solve the problem

<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>5.8.1</version>
    <scope>test</scope>
</dependency>

Upvotes: 0

Views: 232

Answers (1)

howlger
howlger

Reputation: 34137

The log says Compiling 2 source files to C:\workspace\Reverse2\target\classes instead of ...target\test-classes which indicates that src/test is handled as main code, not as test code. In main code, dependencies with the scope test are not available, hence the compile error.

In Maven test code is by default in src/test/java, not in src/test.

Upvotes: 2

Related Questions