Building legacy java 5 project with maven 3First steps are easy, you install maven through apt-get, download java 5 from Oracle site and install it manually (there seem to be openjdk and cgj only packages).
Then you set your JAVA_HOME to point to your new installation and launch maven as usual
mvn clean installAnd that's what you get:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class fileAll maven libs in the Ubuntu package are compiled for java 6...
Do it on your ownAt this point you have to get apache's distribution http://maven.apache.org/download.cgi ; say the file you downloaded is apache-maven-3.1.0-bin.tar.gz, the following command are supposed to be executed as root:
Then you have to point maven to work with the new installation (in a regular, non root, shell)mkdir /usr/local/share/mavencd /usr/local/share/maventar -xvzf <path_to>/apache-maven-3.1.0-bin.tar.gz
export M2_HOME=/usr/local/share/maven/apache-maven-3.1.0And you're done!