When running maven you might see a different JAVA_HOME version than when you're running java -version
In general sense this means when you run mvn a new shell is opened and your JAVA_HOME is (re)set. This means, especially if you need to work with different Java versions, that you must be sure you don't override the version you're working on.
First thing you need to make sure is that you only set JAVA_HOME once.
In relation to Maven you might have something set in :
~/.mavenrc
/etc/mavenrc