Maven 3.9.1 download, install and configure one-stop (no pressure) pro-test

In fact, the maven version is almost the same, so don’t leave if you click on it

foreword

2023年05月06日
Apache Maven 3.9.1 is the latest version recommended for all users.
The Apache Maven team maintains the latest version of the last two series of GA releases.

3.9.1
Currently, the plugin provides Maven API compatibility down to 3.2.5.
The date format is: YYYY-MM-DD

issue date Version required java version
2023-03-14 3.9.1 Java 8

1. Download Apache Maven 3.9.1

1.1. Please check whether your IDEA has this condition and is compatible

insert image description here

1.2, Maven download

Official website
3.9.1

Binary is an executable version that has been compiled and can be used directly. Source is the source code version, which needs to be compiled into executable software before it can be used.

  1. WindowsMavenSelect Binary zip archive usingapache-maven-3.9.1-bin.zip
    insert image description here

Two, Windows installation and configuration Maven

2.1, decompression

Unzip the downloaded file into the directory you set 路径中不要有中文等影响环境的字符

2.2. Create a new repository local warehouse

repositoryCreate a new folder named in its directory ,
the purpose of this folder is to use it as a local Maven warehouse

insert image description here

2.3, configure environment variables

win11:搜索窗口 ---> 编辑系统环境变量--->环境变量--->系统变量(S)--->新建

MAVEN_HOME software path

变量名:MAVEN_HOME
 变量值:D:\software\apache-maven-3.9.1\repository
     //此处的变量值为你存放Maven的解压路径

M2_HOME local warehouse path

变量名:M2_HOME
 变量值:D:\software\apache-maven-3.9.1\repository
     //此处的变量值为你存放Maven的解压后目录中的文件夹的路径

Configure Path

 %MAVEN_HOME%\bin

攻城狮Please go to directory three:Maven配置阿里云等镜像

2.3.1 Friendly icons for newcomers

insert image description here
insert image description here

insert image description here
Create a new MAVEN_HOME
insert image description here
Create a new M2_HOME
insert image description here
Open the Path variable
insert image description here
Input content

 %MAVEN_HOME%\bin

insert image description here
After confirming that there is no error, confirm - close all windows

3. Configure the settings.xml file

Open the file confunder the decompression pathsettings.xml
insert image description here

3.1. Configure the local warehouse address

Find the node localRepository and
configure the local address

As shown in the code,填写自己的本地仓库地址

<localRepository>D:\software\apache-maven-3.9.1\repository</localRepository>

insert image description here

3.2. Configure images such as Maven and Alibaba Cloud

3.2.1. Search mirrors, add Alibaba Cloud image to this object

insert image description here

 
		  <!-- 阿里云spring仓库 -->
		 <mirror>
			<id>aliyunmaven</id>
             <mirrorOf>central</mirrorOf>
             <name>aliyun central maven</name>
             <url>https://maven.aliyun.com/repository/central</url>
		 </mirror>

3.3. Maven configures JDK (it is not recommended to configure here, just configure different jdk for each project)

My code compilation error reported here, and I commented it out.

insert image description here

     <!-- java版本 --> 
     <profile>
           <id>jdk-1.8</id>
           <activation>
               <activeByDefault>true</activeByDefault>
               <jdk>1.8</jdk>
           </activation><properties>
               <maven.compiler.source>1.8</maven.compiler.source>
               <maven.compiler.target>1.8</maven.compiler.target>
               <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
           </properties>
     </profile>

4. Test whether maven is installed successfully

  1. win + r open cmd
  2. Enter mvn -v to view the version
  3. mvn help:system update initialization dependencies

The test configures the mirror address successfully

insert image description here

The test version was successful

insert image description here

5. IDEA maven configuration

insert image description here

This is for my sake, IDEA 2022.2.4 recommends maven 3.8.1,
I will reinstall one according to this

Guess you like

Origin blog.csdn.net/aaxzsuj/article/details/130524829