1) Download and untar maven
tar -xzf apache-maven-3.1.0-bin.tar.gz
ln -s apache-maven-3.1.0/ maven
ln -s apache-maven-3.1.0/ maven
2) Put it in your path (via ~/.bashrc)
export JDK_HOME=/home/chris/java
export JAVA_HOME=$JDK_HOME
export M2_HOME=/home/chris/maven
export PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH
export JAVA_HOME=$JDK_HOME
export M2_HOME=/home/chris/maven
export PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH
3) Quickly create a maven project template
mkdir myproj
cd myproj
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app \
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
cd myproj
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app \
-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
4) Make a couple of useful additions to pom.xml
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
5) Compile it
mvn compile