随笔 - 832  文章 - 2  评论 - 31  阅读 - 167万

spring-boot-dependencies 和 spring-boot-starter-parent

copy自:spring-boot-dependencies 和 spring-boot-starter-parent

构建springboot项目有两种方式:

第一种是继承spring-boot-starter-parent

pom里面指定parent项目:

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.5.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
  </parent>

[推荐,常用]第二种是通过dependencyManagement进行依赖管理

复制代码
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
复制代码

共同点

这两种方式,我们在使用spring-boot-starter的时候都不需要指定版本;

 

  继承spring-boot-starter-parent其实也算是继承自spring-boot-dependencies,我们点开spring-boot-starter-parent,可以看到parent其实也是继承dependencies,parent里面就增加了一些插件,然后指定了maven编译版本:

 

posted on   小破孩楼主  阅读(1112)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
历史上的今天:
2021-08-04 离线(不联网)安装gcc4.8.5
2021-08-04 CentOS6.4系统安装图解
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示