How to install maven environment in linux


System environment
Test system version:RedHat7.5
Maven version:3.8.3
Server creation directory
mkdir -p /usr/local/maven
Switch to directory
cd /usr/local/maven
Copy files to the server
scp /c/Users/cmdhelp/Desktop/apache-maven-3.8.3-bin.tar.gz root@192.168.254.156:/usr/local/maven
Unzip maven
tar -zxvf apache-maven-3.8.3-bin.tar.gz
Enter the maven directory
cd apache-maven-3.8.3
Create a warehouse catalog
mkdir repository
Enter the configuration directory
cd conf
Edit configuration file
vi settings.xml
Add under the localRepository comment
<localRepository>/usr/local/maven/apache-maven-3.8.3/repository</localRepository>
Add environment variables
vi /etc/profile
Environment variable content
export MAVEN_HOME=/usr/local/maven/apache-maven-3.8.3
export PATH=$PATH:$MAVEN_HOME/bin
Environment takes effect
source /etc/profile
View maven version
mvn -v
Was this helpful?

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.