Installing Maven on CentOS7 is an essential step when developing Java projects. This tutorial will introduce in detail how to install and configure Maven on CentOS7 systems, and provide specific code examples to help readers quickly complete the installation process.
First, visit the Maven official website (https://maven.apache.org/download.cgi) to download the latest version of the Maven compressed package. You can choose to download files in bin.tar.gz or bin.zip format. Suppose we save the downloaded file in the /opt directory.
Next, open the terminal, enter the /opt directory, and execute the following command to decompress the Maven file:
cd /opt tar -zxvf apache-maven-3.x.x-bin.tar.gz # 解压文件,版本号可能不同
Edit the /etc/profile
file and add the following configuration at the end:
export MAVEN_HOME=/opt/apache-maven-3.x.x # Maven解压目录 export PATH=$PATH:$MAVEN_HOME/bin
Make the configuration effective:
source /etc/profile
Enter the following command to verify whether Maven is successfully installed:
mvn -version
If you see information similar to the following, Maven has been successfully installed:
Apache Maven 3.x.x Maven home: /opt/apache-maven-3.x.x Java version: 1.8.0_282, vendor: AdoptOpenJDK
At this point, we have completed the installation of Maven on CentOS7 A step of. Now you can use Maven to build and manage Java projects.
I hope this tutorial can help readers successfully install Maven and develop Java projects smoothly. Happy programming!
The above is the detailed content of Simple and easy to understand CentOS7 installation Maven tutorial. For more information, please follow other related articles on the PHP Chinese website!