zoukankan      html  css  js  c++  java
  • 【转载】springbootdependencies 跟 springbootstarterparent

    转载自 「你就像甜甜的益达」的原创文章https://blog.csdn.net/qq_38366063/article/details/110134437

    构建springboot项目有两种方式:

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

    pom.xml 里面指定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进行依赖管理

    一般情况下,企业都有自己的parent依赖包,然后所有的项目都必须继承对应的parent包,这时候,我们就可以通过这种方式使用springboot,使用这种方式记得指定maven编译版本.

        <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编译版本:

  • 相关阅读:
    函数名的使用-闭包-迭代器
    函数
    文件操作
    基础数据补充
    python基础-数据类型(2)
    python基础-数据类型(1)
    PHP 缓存技术(一)
    linux学习笔记整理(九)
    linux学习笔记整理(八)
    linux学习笔记整理(七)
  • 原文地址:https://www.cnblogs.com/kendoziyu/p/15788422.html
Copyright © 2011-2022 走看看