Search code examples
javamavenhamcrest

package org.hamcrest does not exist


I'm getting the error java: package org.hamcrest does not exist. The POM file looks like this:

<dependencies>
    ...
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>
</dependencies>

In ones of the tests, I have this import which is causing the error:

import static org.hamcrest.CoreMatchers.*;

I'm using IntelliJ 2017.3.4

I've tried removing the scope tag and have changed it to compile, and importing other hamcrest packages like hamcrest.core. Also, running mvn clean and rebuilding the project did not work.


Solution

  • Manually deleting the .idea folder and rebuilding worked.