I had the exact same issue with maven project and VS code. i was able to solve using the project settings
Java Projects > (***) Configure Classpath > add as below