Skip to content

Instantly share code, notes, and snippets.

@lioneltchami
Created July 10, 2022 19:27
Show Gist options
  • Select an option

  • Save lioneltchami/085b505a133ae205b4c85d5b6cf38fbd to your computer and use it in GitHub Desktop.

Select an option

Save lioneltchami/085b505a133ae205b4c85d5b6cf38fbd to your computer and use it in GitHub Desktop.
MAVEN SCRIPT
mvn_version=${mvn_version:-3.8.6}
url="http://www.mirrorservice.org/sites/ftp.apache.org/maven/maven-3/${mvn_version}/binaries/apache-maven-${mvn_version}-bin.tar.gz"
install_dir="/opt/maven"
mkdir ${install_dir}
curl -fsSL ${url} | tar zx --strip-components=1 -C ${install_dir}
cat << EOF > /etc/profile.d/maven.sh
#!/bin/sh
export MAVEN_HOME=${install_dir}
export M2_HOME=${install_dir}
export M2=${install_dir}/bin
export PATH=${install_dir}/bin:$PATH
EOF
source /etc/profile.d/maven.sh
echo maven installed to ${install_dir}
mvn --version
# PLEASE NOTE : you need to add THE COMMAND : source /etc/profile.d/maven.sh to ~/.bash_profile or basrch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment