I have tried several options, but this one finally solved my problem. I re-imported the project by following these steps in IntelliJ:
Choose your project from 'Select File or Directory to Import'
In the next screen choose 'Import Project From external model', and choose 'Maven.
For me re-importing maven projects did not solve the issue for an existing projects.