skip to Main Content

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


  1. Try to right-click the build.gradle file of your project and select Reload Project

    Login or Signup to reply.
  2. I got it working by cleaning the java language server cache. Was the first option provided by VSCode itself to fix the issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search