If you are running Maven 2.2.1 (older but latest stable version) and by chance you are still on Ubuntu 11.10 with OpenJDK6, you might run into some issues.
Firstly, remember that it is recommended that you define your environment variables under /etc/environment. Secondly, it is also recommended that you avoid using OpenJDK6. It is understandable that installing it is more easy and convenient, however you will have definitely problems while building your package withmvn package
command (if not while generating your Maven skeleton).
If you have hit the problem and scrolled to the info section, it claims that you have not set your JAVA_HOME environment variable correctly. What you just need to do is to download the Official JDK6, then extract it to any folder you like and point $JAVA_HOME environment variable to that.
It will work just fine after that!