how to install apache maven centos
#download java
sudo yum install java-1.8.0-openjdk-devel
#check java version
java –version
#download the latest
wget http://dlcdn.apache.org/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.tar.gz
#install wget if you not installed
sudo yum install wget
#ensure you use the name of the downloaded file
#incase you download a different version
sudo tar xf /tmp/apache-maven-3.8.3-bin.tar.gz
#change file name to a shorter name and move to a directory
sudo mv apache-maven-3.8.3-bin /opt/maven
sudo nano /etc/profile.d/maven.sh
# filecontent begin
# Apache Maven Environmental Variables
# MAVEN_HOME for Maven 1 - M2_HOME for Maven 2
#path to java jdk
export JAVA_HOME=/usr/lib/jvm/jre-openjdk
#path to maven dir
export M2_HOME=/opt/maven
#path to maven dir
export MAVEN_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}
# filecontent end
#run this command to make maven.sh executable
sudo chmod +x /etc/profile.d/maven.sh
source /etc/profile.d/maven.sh
mvn ––version
#if you have any issue