I am on windows environment and using maven to compile my project. Although I just created the project and added the dependencies for various libararies.
As I added
Sounds like you are running Maven in Eclipse. Eclipse does not consult JAVA_HOME.
Make sure you have set your JRE in Eclipse preferences to your desired JDK.