1. 项目信息字段
标签 | 含义 | 如何填写 |
---|---|---|
<parent> | 指定父 POM | Spring Boot 项目直接写 spring-boot-starter-parent |
<groupId> | 项目组织唯一标识 | 公司/组织/学校域名倒写 |
<artifactId> | 项目唯一名称 | 与项目文件夹一致 |
<version> | 项目版本号 | 1.0 / 1.0-SNAPSHOT |
<name> | 项目名称 | 可写中文 |
<description> | 项目描述 | 可写中文 |
<packaging> | 打包方式 | jar / war / pom |
relativePath | 相对路径,若为空则从本地仓库或远程仓库拉取,如果不为空优先从指定的地方拉去 | 比如父模块什么都不填:<relativePath/> ,比如子模块要填父模块的pom.xml地址:<relativePath>../pom.xml</relativePath> |
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/>
</parent>
<groupId>com.akbar</groupId>
<artifactId>sky-take-out</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Sky 外卖管理系统</name>
<description>一个基于 Spring Boot 的外卖管理系统,用于学习和毕业设计</description>
<packaging>jar</packaging>
2.依赖范围
- log4j:所有阶段我们都需要打印日志。
- junit:junit只在测试阶段使用。
- servlet-api:不能打包,因为tomcat中也有
servlet-api
,为了避免版本冲突,servlet-api
不参与打包。 - jdbc:我们写代码的时候根本没有用过
jdbc
这个类名,因为jdbc
只是一个驱动,所以它只需要参与打包阶段,注意不能不打包,因为MySQL
等数据库需要它。
3.项目构建的生命周期
- 安装:这里的install(安装)指的是我们把项目打包好以后别的项目可以导入我们的项目作为依赖。
4.插件
比如springboot 项目有这样的插件:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>