参考下面文章的学习笔记:
spring boot中pom文件解读
搭建SpringBoot项目阶段groupId和artifactId怎么写呢?
springboot中pom文件详解
POM标签大全详解
springboot入门–pom文件解读
SpringBoot 常用依赖
spring-boot-starter家族成员简介
Spring Boot Starter 简介
几乎最简单的一个SpringBoot 项目的 Pom文件,通过她来了解一下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">
<modelVersion>4.0.0modelVersion>
<parent>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-parentartifactId>
<version>2.5.5version>
<relativePath/>
parent>
<groupId>com.examplegroupId>
<artifactId>nodepartifactId>
<version>0.0.1-SNAPSHOTversion>
<packaging>jarpackaging>
<name>nodepname>
<url>http://www.qwqwq.com/banseonurl>
<description>nodepdescription>
<properties>
<java.version>1.8java.version>
<project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8project.reporting.outputEncoding>
properties>
<dependencies>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-testartifactId>
<scope>testscope>
dependency>
dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-maven-pluginartifactId>
plugin>
plugins>
build>
project>
groupId + artifactId 唯一确定当前项目;
name 是项目的名称、只是一般 artifactId 和 name 设置成一样的了;
springboot 在配置上相比spring要简单许多, 其核心在于各种springboot starter; 由于springboot 的自动装配,在使用springboot搭建一个项目时, 只需要引入官方提供的starter, 就可以直接使用里面的功能, 免去了各种配置。
有关 Spring Boot Starter 命名规范:
spring-boot-starter-*
:其中 *
指特定的应用程序代号或名称,譬如 spring-boot-starter-jdbc
*-spring-boot-starter
:譬如 mybatis-spring-boot-starter
;Spring Boot 核心 starter,包括自动配置支持,日志和YAML
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starterartifactId>
dependency>
对全栈web开发的支持,包括Tomcat和spring-webmvc
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-webartifactId>
dependency>
<mybatis-spring-boot-starter.version>1.3.2mybatis-spring-boot-starter.version>
<dependency>
<groupId>org.mybatis.spring.bootgroupId>
<artifactId>mybatis-spring-boot-starterartifactId>
<version>${mybatis-spring-boot-starter.version}version>
dependency>
<mapper-spring-boot-starter.version>1.1.7mapper-spring-boot-starter.version>
<dependency>
<groupId>tk.mybatisgroupId>
<artifactId>mapper-spring-boot-starterartifactId>
<version>${mapper-spring-boot-starter.version}version>
dependency>
对JDBC数据库的支持
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-jdbcartifactId>
dependency>
MySQL驱动
<mysql-connector-java.version>8.0.15mysql-connector-java.version>
<dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
<scope>runtimescope>
dependency>
Oracle驱动
<oracle.version>11.2oracler.version>
<dependency>
<groupId>org.oraclegroupId>
<artifactId>oracleartifactId>
<version>${oracle.version}version>
dependency>
对MongoDB 数据库的支持,包括spring-data-mongodb
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-data-mongodbartifactId>
dependency>
对REDIS数据库的支持,包括Spring-redis
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-redisartifactId>
dependency>
<druid.version>1.1.5druid.version>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>druidartifactId>
<version>${druid.version}version>
dependency>
<dependency>
<groupId>com.zaxxergroupId>
<artifactId>HikariCPartifactId>
dependency>
对常用测试依赖的支持,包括JUnit, Hamcrest和Mockito,还有spring-test模块
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-testartifactId>
<scope>testscope>
dependency>
对spring -security模板引擎的支持
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-securityartifactId>
dependency>
备注:(权限控制
<shrio-spring.version>1.4.0shrio-spring.version>
<dependency>
<groupId>org.apache.shirogroupId>
<artifactId>shiro-springartifactId>
<version>${shrio-spring.version}version>
dependency>
<dubbo-spring-boot-starter.version>0.2.1.RELEASEdubbo-spring-boot.version>
<dependency>
<groupId>com.alibaba.bootgroupId>
<artifactId>dubbo-spring-boot-starterartifactId>
<version>${dubbo-spring-boot-starter.version}version>
dependency>
(父工程)
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloudgroupId>
<artifactId>spring-cloud-dependenciesartifactId>
<version>Finchley.M9version>
<type>pomtype>
<scope>importscope>
dependency>
dependencies>
dependencyManagement>
<dependency>
<groupId>org.springframework.cloudgroupId>
<artifactId>spring-cloud-starter-netflix-eureka-serverartifactId>
dependency>
<dependency>
<groupId>org.springframework.cloudgroupId>
<artifactId>spring-cloud-starter-netflix-eureka-clientartifactId>
dependency>
<dependency>
<groupId>org.springframework.cloudgroupId>
<artifactId>spring-cloud-starter-openfeignartifactId>
dependency>
<fastjson.version>1.2.16fastjson.version>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>fastjsonartifactId>
<version>${fastjson.version}version>
dependency>
<jackson-databind.version>2.9.8jackson-databindversion>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-databindartifactId>
<version>${jackson-databind.version}version>
dependency>
<gson.version>2.8.5gson.version>
<dependency>
<groupId>com.google.code.gsongroupId>
<artifactId>gsonartifactId>
<version>${gson.version}version>
dependency>
用于java.lang层次结构中的类,或被认为是标准的,以证明java.lang中的存在
<commons.lang3.version>3.7commons.lang3.version>
<dependency>
<groupId>org.apache.commonsgroupId>
<artifactId>commons-lang3artifactId>
<version>${commons.lang3.version}version>
dependency>
包含实用程序类,流实现,文件过滤器,文件比较器,endian转换类等等
<commons.io.version>2.6commons.io.version>
<dependency>
<groupId>commons-iogroupId>
<artifactId>commons-ioartifactId>
<version>${commons.io.version}version>
dependency>
扩展和扩充Java Collections Framework的类型
<commons-collections4.version>4.3<commons-collections4.version>
<dependency>
<groupId>org.apache.commonsgroupId>
<artifactId>commons-collections4artifactId>
<version>${commons-collections4.version}version>
dependency>
允许与其他众所周知的日志记录系统进行可配置的桥接
<commons-logging.version>1.2commons-logging.version>
<dependency>
<groupId>commons-logginggroupId>
<artifactId>commons-loggingartifactId>
<version>${commons-logging.version}version>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-actuatorartifactId>
dependency>
<slf4j-api.version>1.8.0-beta4slf4j-api.version>
<dependency>
<groupId>org.slf4jgroupId>
<artifactId>slf4j-apiartifactId>
<version>${slf4j-api.version}version>
dependency>
简化JavaBean开发
<lombok.version>1.8.16lombok.version>
<dependency>
<groupId>org.projectlombokgroupId>
<artifactId>lombokartifactId>
<version>${lombok.version}version>
dependency>
分页插件
<pagehelper-spring-boot-starter.version>1.25pagehelper-spring-boot-starter>
<dependency>
<groupId>com.github.pagehelpergroupId>
<artifactId>pagehelper-spring-boot-starterartifactId>
<version>${pagehelper-spring-boot-starter.version}version>
dependency>
对FreeMarker模板引擎的支持
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-freemarkerartifactId>
dependency>
对javax.mail的支持
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-mailartifactId>
dependency>
<commons-fileupload.version>1.3.1commons-fileupload.version>
<fastdfs-client.version>1.25-RELEASEfastdfs-client.version>
<dependency>
<groupId>commons-fileuploadgroupId>
<artifactId>commons-fileuploadartifactId>
<version>${commons-fileupload.version}version>
dependency>
<dependency>
<groupId>org.csourcegroupId>
<artifactId>fastdfs-clientartifactId>
<version>${fastdfs-client.version}version>
dependency>
<poi.version>3.16poi.version>
<poi-ooxml.version>3.14poi-ooxml.version>
<dependency>
<groupId>org.apache.poigroupId>
<artifactId>poiartifactId>
<version>${poi.version}version>
dependency>
<dependency>
<groupId>org.apache.poigroupId>
<artifactId>poi-ooxmlartifactId>
<version>${poi-ooxml.version}version>
dependency>
<activiti-engine.version>7-201802-EAactiviti-engine.version>
<dependency>
<groupId>org.activitigroupId>
<artifactId>activiti-engineartifactId>
<version>${activiti-engine.version}version>
dependency>
<kaptcha.version>2.3.2kaptcha.version>
<dependency>
<groupId>com.github.pengglegroupId>
<artifactId>kaptchaartifactId>
<version>${kaptcha.version}version>
dependency>
<aliyun-java-sdk-core.version>3.3.1aliyun-java-sdk-core.version>
<aliyun-java-sdk-dysmsapi.version>1.0.0aliyun-java-sdk-dysmsapi.version>
<dependency>
<groupId>com.aliyungroupId>
<artifactId>aliyun-java-sdk-coreartifactId>
<version>${aliyun-java-sdk-core.version}version>
dependency>
<dependency>
<groupId>com.aliyungroupId>
<artifactId>aliyun-java-sdk-dysmsapiartifactId>
<version>${aliyun-java-sdk-dysmsapi.version}version>
dependency>
<wxpay-sdk.version>0.0.3wxpay-sdk.version>
<dependency>
<groupId>com.github.wxpaygroupId>
<artifactId>wxpay-sdkartifactId>
<version>${wxpay-sdk.version}version>
dependency>
<sdk-alipay-starter.version>3.7.4.ALLsdk-alipay-starter.version>
<dependency>
<groupId>net.guerlabgroupId>
<artifactId>alipay-sdk-javaartifactId>
<version>${sdk-alipay-starter.version}version>
dependency>
<spring-boot-devtools.version>2.1.3.RELEASEspring-boot-devtools>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-devtoolsartifactId>
<optional>trueoptional>
<scope>truescope>
dependency>
<httpclient.version>4.5.7httpclient.version>
<dependency>
<groupId>org.apache.httpcomponentsgroupId>
<artifactId>httpclientartifactId>
dependency>
用于替换JDK日期处理的日期和时间库
<joda-time.version>2.10.1joda-time.version>
<dependency>
<groupId>joda-timegroupId>
<artifactId>joda-timeartifactId>
<version>${joda-time.version}version>
dependency>
<dependency>
<groupId>io.springfoxgroupId>
<artifactId>springfox-swagger2artifactId>
<version>2.9.2version>
dependency>
<dependency>
<groupId>io.springfoxgroupId>
<artifactId>springfox-swagger-uiartifactId>
<version>2.9.2version>
dependency>
<dependency>
<groupId>com.github.xiaoymingroupId>
<artifactId>swagger-bootstrap-uiartifactId>
<version>1.9.6version>
dependency>
spring boot打包插件,主要将spring boot应用打包成jar文件或者war文件
<plugin>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-maven-pluginartifactId>
plugin>