A bash script that installs the latest stable release of Apache Maven on Debian and its derivatives (Ubuntu, Linux Mint, etc.).
- Installs missing dependencies (
curl,unzip,libxml2-utils) viaapt-getif needed - Queries Maven Central repository metadata to determine the latest stable version, excluding alpha, beta, and rc releases
- Downloads the binary ZIP archive from the official Apache Maven release mirror
- Extracts it to
/opt/maven-X.Y.Z - Creates a symlink
/opt/mavenpointing to/opt/maven-X.Y.Z - Creates
/etc/profile.d/maven.shto setM2_HOME,MAVEN_HOME, and add Maven'sbindirectory toPATH
If the target directory already exists, the download and extraction steps are skipped.
sudo ./install-maven.shAfter installation, either log out and back in or source the environment file manually:
source /etc/profile.d/maven.shThen verify the installation:
mvn --versionThe script must be run as root (via sudo). It will automatically install any missing dependencies.
This project is licensed under the Apache License 2.0.