Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure maven for CentOS

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to install and configure maven in CentOS, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

one。 download

Official download address: maven download

two。 Decompression

Tar-zxvf apache-maven-3.3.9-bin.tar.gz (install path is: / usr/local/maven)

three。 Installation

Add the following to the / etc/profile file

Export MAVEN_HOME=/usr/local/maven

Export PATH=$MAVEN_HOME/bin:$PATH

four。 Take effect

Source / etc/profile

five。 Verification

Mvn-v

As shown in the above figure, the version information is displayed, indicating that the installation is successful!

six。 Configure the local warehouse

The settings.xml file in the MAVEN_HOME/conf directory is the configuration file for Maven.

/ usr/local/maven/local_repository

seven。 Maven commonly used commands Maven commands are very many, to learn commands, you must first understand the life cycle of Maven.

Maven first validates and processes the reference resources, then compiles the project, and if it is not declared to skip the test, it compiles the test code and tests it to produce a test report. Last,

Maven packages the compiled content for distribution.

Maven commands correspond to the lifecycle of Maven, and a command often contains multiple lifecycles, for example, mvn package completes all the above steps.

Here are a few commonly used commands

Mvn compile compiles the project, this command is used to compile the Maven project, and after executing the command, the corresponding class file is generated in classes in the target folder. Mvn test compiles and runs unit tests, compiling automatically first, and running all test cases. Mvn package packaging (jar or war) mvn install installs the project to the local repository, releases and generates the corresponding package package. Mvn clean empties the project and deletes the target folder, that is, the generated package package and files such as class. Mvn eclipse:eclipse generates eclipse project

The above is all the contents of the article "how to install and configure maven for CentOS". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report