博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SpringBoot2.x的Maven依赖配置
阅读量:6980 次
发布时间:2019-06-27

本文共 3834 字,大约阅读时间需要 12 分钟。


本篇主要说明以下内容:

1.SpringBoot2.x中Maven的配置内容,即:pom.xml的内容说明


1 Maven依赖的配置方式

使用Maven来配置SpringBoot2.x,有两种方式:

1.SpringBoot2.x的父依赖,在使用生成的项目中,会是这种方式

2.项目独立引入SpringBoot2.x的pom依赖

1.1 SpringBoot2.x父依赖

这种方式,项目完整的pom.xml文件,如下:

4.0.0
cc.anxminise.spblearn
application
0.0.1-SNAPSHOT
jar
application
Demo project for Spring Boot
org.springframework.boot
spring-boot-starter-parent
2.0.6.RELEASE
UTF-8
UTF-8
1.8
org.springframework.boot
spring-boot-starter-web
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-maven-plugin

以上关键的配置,如下:

xml节点名称 说明
parent 标明项目按SpringBoot2.x默认配置来处理
plugin.spring-boot-maven-plugin 对SpringBoot项目进行打包

如果项目中已经有自己的parent,此时,可以使用项目独立引入的方式。

1.2 项目独立引入

这种方式是通过pom文件中的dependencyManagement标签来实现SpringBoot的引入,完整的pom.xml文件如下:

4.0.0
cc.anxminise.spblearn
application
0.0.1-SNAPSHOT
jar
application
Demo project for Spring Boot
org.springframework.boot
spring-boot-dependencies
2.0.6.RELEASE
pom
import
UTF-8
UTF-8
1.8
org.springframework.boot
spring-boot-starter-web
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-maven-plugin
cc.anxminise.learnspboot.Application
repackage

以上关键的配置,如下:

xml节点名称 说明
dependencyManagement.dependencies.dependency.spring-boot-dependencies 标明项目按SpringBoot2.x默认配置来处理
plugin.spring-boot-maven-plugin 对SpringBoot项目进行打包,这里需要手动配置应用的启动类

这种方式,相对而言,更为的灵活。

转载于:https://www.cnblogs.com/anxminise/p/9854216.html

你可能感兴趣的文章
py 决策树①
查看>>
帮您找到正确的提问渠道
查看>>
出差第二天
查看>>
JavaScript—ES6关于Promise的用法(19)
查看>>
Google发布机器学习平台Tensorflow游乐场~带你玩神经网络(转载)
查看>>
设计模式 之 访问者模式
查看>>
读到良葛格的反思"Hello World"
查看>>
曾经被微软视为毒瘤的“开源”,现在却成了“宠儿”
查看>>
VR、AR成为Facebook F8大会上最亮眼主角
查看>>
Spring4-自动装配Beans-通过注解@Autowired在Set方法上
查看>>
RAC 11.2的新特性
查看>>
2星|《金融学从入门到精通》:金融学名词解释的堆砌
查看>>
数据库四种事务隔离级别
查看>>
基于模板的excel导出
查看>>
基于Nginx负载均衡方案
查看>>
双活数据中心
查看>>
python练习题
查看>>
cut命令
查看>>
powershell最常用的命令之(一)
查看>>
LAMP一键安装脚本
查看>>