Install the latest version of Maven on Linux -

Dermot Butterfield - 29 July 2018

tl;dr

Install the latest version of Maven on Linux

This is a quick update to outline how to install the latest version of Maven on Linux. In the example below I have outlined the script required to install maven on Ubuntu and RedHat without a package manager. If you are running an older version of Ubuntu (14.04) or if you are on RedHat you will not be able to access the latest version from the package manager.

This is broken down into installing and symlinking the new version. I have linked out to my source repo for some bash scripts which you can run if you are keen.

#!/bin/bash

#identify the latest version of maven
latest=$(curl http://www-us.apache.org/dist/maven/maven-3/ | tac | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,3\}[0-9]\).*/\1/p' | head -1)

#download it
wget http://www-us.apache.org/dist/maven/maven-3/$latest/binaries/apache-maven-$latest-bin.tar.gz

#Unpack it
sudo tar -zxf apache-maven-$latest-bin.tar.gz -C /usr/local/

#create a sym link to it
sudo ln -s /usr/local/apache-maven-$latest/bin/mvn /usr/bin/mvn

#confirm successful installation
echo "You have installed `mvn -v`"
If you need assistance removing any existing version installed by the package manager and then you can use the following:
# Ubuntu 
sudo apt-get purge -y maven

Contact Us

I hope you found this useful or if you have any questions don't hesitate to leave a comment or contact support[@]tomred[.]net

Articles

Java

I have spent most of my time working on these little bits of logic or snippets. These come from problems or issues I have encountered over the year. These are insights I have researched or provided as code review feedback.

Oracle WebCenter (FatWire)

During my time working in consulting I was tasked many times with delivering FatWire sites. I took notes due to the lack of useful documentation at the time. These are the results of those notes made and shared.

CSS HTML JS

I believe the majority of time on a project is spent with the UI. Web is no exception. I have compiled a set of articles covering HTML, CSS and JS with the intention of taking the sting out of this work.

DevOps

A space dedicated to all those things you need to know beyond writing code. This covers Linux, Windows, Git and SVN among other hopefully useful nuggets.

Security

I picked up some pointers over the years consulting for government and banking sectors before entering a PCI DSS development environment. This section covers aspects like coding, testing, code review and best practice.

Apps

Apps is a section which offers access to bits and pieces I have put together over the last few years. This includes Random Password Generator and Base64 Encoder.