Home > Java > javaTutorial > body text

Simple and easy to understand CentOS7 installation Maven tutorial

王林
Release: 2024-02-21 15:18:03
Original
397 people have browsed it

Simple and easy to understand CentOS7 installation Maven tutorial

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.

Step 1: Download Maven

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.

Step 2: Decompress Maven

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     # 解压文件,版本号可能不同
Copy after login

Step 3: Configure environment variables

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

Make the configuration effective:

source /etc/profile
Copy after login

Step 4: Verify the installation

Enter the following command to verify whether Maven is successfully installed:

mvn -version
Copy after login

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

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!