Search code examples
javaspring-bootmavenintellij-ideajunit

IntelliJ can't find installed packages


I've just installed IntelliJ and imported a Maven / Spring Boot project. I've set up my run configuration as "application", but when I try to run it, it fails and complains of not being able to resolve dependencies. When I check my local Maven repository, those dependencies are installed:

/Users/user/Projects/myapplication/src/test/java/com/something
/SomethingServiceTest.java:23:29
java: package org.junit.jupiter.api does not exist

local maven repo:

$ ll ~/.m2/repository/org/junit/jupiter/
total 0
drwxr-xr-x  6 user  Users   192B 21 Aug  2020 ./
drwxr-xr-x  6 user  Users   192B  2 Sep  2020 ../
drwxr-xr-x  3 user  Users    96B 21 Aug  2020 junit-jupiter/
drwxr-xr-x  3 user  Users    96B 21 Aug  2020 junit-jupiter-api/
drwxr-xr-x  3 user  Users    96B 21 Aug  2020 junit-jupiter-engine/
drwxr-xr-x  3 user  Users    96B 21 Aug  2020 junit-jupiter-params/

Solution

  • IntelliJ and the pom.xml are probably not in-sync.

    Right click on the pom.xml and Maven -> Reload Project