Maven download and installation
What is maven?
Maven Project Object Model (POM), a project management tool software that can manage project construction, reporting and documentation through a small piece of description information. In addition to featuring program building capabilities, Maven also provides advanced project management tools. Due to the high reusability of Maven's default build rules, simple projects can often be built with two or three lines of Maven build scripts. Due to Maven's project-oriented approach, many Apache Jakarta projects use Maven when publishing documents, and the proportion of company projects using Maven continues to grow.
The word Maven comes from Yiddish (Jewish), meaning the accumulation of knowledge, and was originally used in the Jakata Turbine project to simplify the construction process. At the time there were a few projects (with their own Ant build files), with only minor differences, and the JAR files were all maintained by CVS. So it is desirable to have a standardized way to build projects, a clear way to define the composition of the project, an easy way to publish project information, and an easy way to share JARs among multiple projects.
Maven official website http://maven.apache.org can download the maven tool. This tool is written in java language, so this tool directly runs the construction project and manages project dependencies. It is necessary to configure the jdk development environment variables.
maven official website http://maven.apache.org
Central warehouse address https://mvnrepository.com
Download the maven tool
Enter the home page of the official website, click Download to enter the download page
The current version is the latest version 3.8.7, click apache-maven-3.8.7-bin.zip to start downloading.
After the download is complete, unzip and remove the suffix (optional) and configure environment variables
The decompression location is placed in "E:/soft/maven"
Right-click My Computer, click the Properties column, find Advanced System Settings, click Environment Variables and find path to edit. (It is consistent with the environment variables for configuring JDK. If you don’t understand, the environment variables for configuring JDK are mentioned in the previous article)
Configure the environment variables and view the information through the cmd command
mvn -v view version information
mvn -h View help information for each command
Configure the maven tool
Find the path where maven was just stored, enter the conf folder, and use Notepad to open the settings.xml file.
You can delete the contents of the file settings.xml, and copy the following code into settings.xml. (Because most of the content inside is comments)
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
<!-- Default: ${user.home}/.m2/repository -->
<localRepository>E:/soft/maven/repo</localRepository>
<mirrors>
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>
<!-- 配置项目开发编译的jdk版本 -->
<profiles>
<profile>
<id>jdk-17</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>17</jdk>
</activation>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.compilerVersion>17</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
</settings>
Run IDEA to configure maven
Configure according to the steps in the figure below, because IDEA comes with the maven tool by default, we need to configure it ourselves if we don’t use it.