In my case, the issue was caused by the JDK version.
To solve this I suggest going into your pom file and check the <jdk.version>1.7</jdk.version>.
Afterward check the java version in your cmd(windows) or terminal ( OSX or LINUX ) by typing: java -version.
Compare the version shown in the terminal\command prompt with what you have in your pom file.
Make sure they are the same. Then run your project again.