Home > Java > javaTutorial > body text

Complete guide to install Maven on CentOS7

WBOY
Release: 2024-02-20 10:57:06
Original
623 people have browsed it

Complete guide to install Maven on CentOS7

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

Save and exit the editor, and then use the following command to make the modifications effective:

source /etc/profile
Copy after login

Step 5: Verify the installation

After completing the above steps, we can verify whether Maven is successfully installed through the following command:

mvn -version
Copy after login

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
...
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template