The Case for Automated Maven Installation Manual installation of Maven involves downloading the binary distribution, configuring environment variables, and ensuring compatibility with your system. These steps can be cumbersome and prone to errors, particularly when setting up multiple development environments. By creating an automated installation script, you can guarantee consistent installations, reduce manual intervention, and ensure compatibility across different systems.
--------------------------------------------------------------------------------------------------------------------------
#!/bin/bash
sudo yum update -y
sudo yum install -y wget
MAVEN_VERSION="3.9.4"
echo Download and extract Maven
wget "https://dlcdn.apache.org/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz"
tar -zxvf "apache-maven-3.9.4-bin.tar.gz"
sudo mv "apache-maven-3.9.4" /opt/
echo "export MAVEN_HOME=/opt/apache-maven-3.9.4" >> ~/.bashrc
echo "export PATH=\$MAVEN_HOME/bin:\$PATH" >> ~/.bashrc
source ~/.bashrc
mvn --version
Post a Comment