Here is the solution that worked for me,
Right click on project folder > At the very bottom click maven > Click Download Sources or Download Sources and Documentation.
If similar issues happens in eclipse IDE, it can be resolved by doing
Right Click on project folder > Maven > Download Sources