简体   繁体   中英

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/

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

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

I've been the same problems. Sometimes I try to remove or change the name of the ~/.m2/repository directory. After that, I make

mvn clean compile and install

Try this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM