Reputation: 552
I am having a problem with IntelliJ not finding the imports (and subsequently the classes)
At the moment the code is bare bones and doesn't do anything, I am in the process of practicing my skills but I can't get past this error.
The IntelliJ project can be found on GitHub here
The code in question is MovieRecommenderSystemApplicationTests.java
package com.jreid.spring.basics.movierecommendersystem;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class MovieRecommenderSystemApplicationTests {
@Test
void contextLoads() {
}
}
And the errors are as follows:
java: package org.junit.jupiter.api does not exist
java: package org.springframework.boot.test.context does not exist
java: cannot find symbol
symbol: class SpringBootTest
java: cannot find symbol
symbol: class Test
location: class com.jreid.spring.basics.movierecommendersystem.MovieRecommenderSystemApplicationTests
IntelliJ finds the symbols without any problems.
Any help would be appreciated. Thanks
Upvotes: 3
Views: 5240
Reputation: 91
I had same issue, version Build #IC-251.21418.62, that I believe was caused by having more than 1 project open in 2 separate IJ tabs. Exiting IJ and opening just 1 project resolved issue. Hoping this is not a limitation on IJ on having > 1 project open at same time. This solution is also based on Mike's previous solution, just a 1st simpler approach.
Upvotes: 0
Reputation: 421
My remedy to the solution when intellij does not find jupiter or Q* objects (generated and compiled from another project):
Build,execution,deployment.build tools.reload project after changes in the build script.enabled Build,execution,deployment.build tools.maven.execute goals recursively.enabled Build,execution,deployment.build tools.maven.use settings from mvn/config.enabled Build,execution,deployment.build tools.maven.runner.Delegate IDE buildrun actions to Maven.DISabled Build,execution,deployment.build tools.maven.runner.Run in background.enabled Build,execution,deployment.build tools.maven.runner.Skip Tests.DISabled
Upvotes: 0
Reputation: 11
Enable auto import for maven dependency in settings Import Maven projects automatically
. And do mvn clean install
. If it won't work, use Invalidate Caches
menu to reindex mvn repository.
And be sure you have all dependencies in pom.xml of course
Upvotes: 1