When I am trying to launch my Spring application using VSCode’s Extension Pack for Java which has
import static org.assertj.core.api.Assertions.catchException;
in one of the tests, I get build failed
with the following message:
The import org.assertj.core.api.Assertions.catchException cannot be resolved
However, when I press Proceed
, the app works normally. I have
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.22.0'
in my gradle.build
file and it also works fine if I compile it with gradle build
. How can I fix it?
2
Answers
Try to right-click the
build.gradle
file of your project and selectReload Project
I got it working by cleaning the java language server cache. Was the first option provided by VSCode itself to fix the issue.