SpringBoot之Pom.xml

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 3          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
 4     <modelVersion>4.0.0</modelVersion>
 5     <parent>
 6         <groupId>org.springframework.boot</groupId>
 7         <artifactId>spring-boot-starter-parent</artifactId>
 8         <version>2.4.4</version>
 9         <relativePath/> <!-- lookup parent from repository -->
10     </parent>
11     <groupId>com.example</groupId>
12     <artifactId>demo</artifactId>
13     <version>0.0.1-SNAPSHOT</version>
14     <name>demo</name>
15     <description>Demo project for Spring Boot</description>
16     <properties>
17         <java.version>11</java.version>
18     </properties>
19     <dependencies>
20         <dependency>
21             <groupId>org.springframework.boot</groupId>
22             <artifactId>spring-boot-starter-web</artifactId>
23         </dependency>
24 
25         <dependency>
26             <groupId>org.springframework.boot</groupId>
27             <artifactId>spring-boot-starter-test</artifactId>
28             <scope>test</scope>
29         </dependency>
30     </dependencies>
31 
32     <build>
33         <plugins>
34             <plugin>
35                 <groupId>org.springframework.boot</groupId>
36                 <artifactId>spring-boot-maven-plugin</artifactId>
37             </plugin>
38         </plugins>
39     </build>
40 
41 </project>

一、创建好SpringBoot项目后系统默认添加了spring-boot-starter-parent配置。

1    <parent>
2         <groupId>org.springframework.boot</groupId>
3         <artifactId>spring-boot-starter-parent</artifactId>
4         <version>2.4.4</version>
5         <relativePath/> <!-- lookup parent from repository -->
6     </parent>

spring-boot-starter-parent提供了如下默认配置:

1、java默认使用版本。

2、编码格式默认使用UTF-8。

3、提供了dependencyManagement,使开发者在引入其他依赖时不必输入版本号,方便依赖管理。

4、默认的资源过滤与插件配置。

 二、开发web项目需要引入一个web的starter

1  <dependencies>
2         <dependency>
3             <groupId>org.springframework.boot</groupId>
4             <artifactId>spring-boot-starter-web</artifactId>
5         </dependency>
6 
7     </dependencies>

 

三、手动查找添加依赖 https://mvnrepository.com/

原文地址:https://www.cnblogs.com/mingforyou/p/14581689.html