SpringBoot环境配置

Windows

操作系统:Windows 11 Pro 24H2

安装包路径

添加环境变量

  1. 新建系统变量
    • 变量名为JAVA_HOME,变量值为C:\Software\Java\jdk-24
    • 变量名为MAVEN_HOME,变量值为C:\Software\Java\Maven
  2. 系统变量Path中添加C:\Software\Java\jdk-24\binC:\Software\Java\Maven\bin

添加完成后打开PowerShell,执行java --version,显示如下

1
2
3
4
5
❯ java --version
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
java 24.0.1 2025-04-15
Java(TM) SE Runtime Environment (build 24.0.1+9-30)
Java HotSpot(TM) 64-Bit Server VM (build 24.0.1+9-30, mixed mode, sharing)

执行mvn -v,显示如下

1
2
3
4
5
6
7
❯ mvn -v
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Apache Maven 3.9.10 (5f519b97e944483d878815739f519b2eade0a91d)
Maven home: C:\Software\Java\Maven
Java version: 24.0.1, vendor: Oracle Corporation, runtime: C:\Software\Java\jdk-24
Default locale: en_US, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

配置Maven本地仓库

C:\Software\Java\Maven\conf\settings.xml文件第53行的localRepository修改为

1
2
3
4
5
6
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
-->
<localRepository>C:\Software\Java\Maven\repo</localRepository>

修改第147行的mirrors节点为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>

<mirror>
<id>maven-default-http-blocker</id>
<mirrorOf>external:http:*</mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
<url>http://0.0.0.0/</url>
<blocked>true</blocked>
</mirror>
|-->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
</mirrors>

配置Intellij IDEA

[Settings] → [Build, Execution, Deployment] → [Build Tools] → [Maven]

配置Maven路径为

  • [Maven home path]:C:\Software\Java\Maven
  • [User settings file]:C:\Software\Java\Maven\conf\settings.xml
  • [Local repository]:C:\Software\Java\Maven\repo

新建项目工程

(未完待续……)