pom文件中各个标签的功能
<?xml version="1.0" encoding="UTF-8"?>
2.project标签:声明pom的命名空间
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> </project>
3.modelVersion:指定pom文件的版本
<modelVersion>4.0.0</modelVersion>
4.parent:指定父pom文件 groupId:一般为域名倒写 atrifactId:项目全局唯一id version:项目版本
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.5.RELEASE</version> </parent>
5.properties:用于声明常量
<properties> <java.version>1.8</java.version> </properties>
6.dependencies :依赖的根元素 dependency:提供依赖jar的坐标位置 exclusion:排除导入jar包时不需要的部分jar包
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> </dependencies>
7.build:项目构建标签,可以包含各种插件 plugins:插件标签 plugin:此处插件提供了启动springboot工程的功能
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
8.dependencyManagement:只对其中的依赖进行版本管理,而没有实际的jar包引入
<dependencyManagement> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.2.7</version> </dependency> </dependencies> </dependencyManagement>