Detailed tutorial on how to install Maven under CentOS7
Maven is a popular project management tool developed by the Apache Software Foundation. It is mainly used to manage the construction, dependency management and project information management of Java projects. This article will detail the steps on how to install Maven in CentOS7 system, as well as specific code examples.
Step 1: Update the system
Before installing Maven, you first need to ensure that the system is up to date. Open the terminal and run the following command to update the system:
sudo yum update
Step 2: Download Maven
Next, we need to download the latest version of Maven from the official Apache Maven website . You can download it in the terminal through the following command:
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.tar.gz
Step 3: Decompress the Maven file
After the download is completed, we will decompress the Maven compressed file to the /usr/local directory Next, you can use the following command:
sudo tar -zxvf apache-maven-3.8.3-bin.tar.gz -C /usr/local
Step 4: Configure environment variables
In order to be able to access Maven from any location, we need to configure environment variables. Edit the /etc/profile file and add the following content:
export MAVEN_HOME=/usr/local/apache-maven-3.8.3 export PATH=$PATH:$MAVEN_HOME/bin
Save and exit the editor, and then use the following command to make the modifications effective:
source /etc/profile
Step 5: Verify the installation
After completing the above steps, we can verify whether Maven is successfully installed through the following command:
mvn -version
If you see output similar to the following, Maven has been successfully installed and configured:
Apache Maven 3.8.3 (...) Maven home: /usr/local/apache-maven-3.8.3 ...
At this point, the installation of Maven under the CentOS7 system is completed. Now you can start using Maven to build and manage dependencies in your project. Hope this article helps you!
The above is the detailed content of Complete guide to install Maven on CentOS7. For more information, please follow other related articles on the PHP Chinese website!