Created
March 18, 2021 05:38
-
-
Save DineshSolanki/3d231d05d6cfcad36b83ce8f2f257c9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ask the user for maven binary link | |
echo "Please input maven binary link : ex-https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" | |
echo | |
read mavenLink | |
echo You entered $mavenLink | |
wget $mavenLink -P /tmp | |
sudo tar xf /tmp/apache-maven-*.tar.gz -C /opt | |
folder="apache-maven-${mavenLink:46:5}/bin" | |
sudo ln -s /opt/${folder} /opt/maven | |
sudo nano /etc/profile.d/maven.sh | |
#export PATH="${PATH}/opt/${folder}" | |
echo "Please input JAVA_HOME Path | |
echo -e 'export JAVA_HOME=/usr/lib/jvm/default-java\n | |
export M2_HOME=/opt/maven\n | |
export MAVEN_HOME=/opt/maven\n | |
export PATH=${M2_HOME}/bin:${PATH}' >> ~/.bashrc | |
sudo chmod +x /etc/profile.d/maven.sh | |
source /etc/profile.d/maven.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment