springboot依赖管理

1、利用idea工具构建springboot项目,不添加任何组件的情况下,生成项目pom文件依赖如下:

<?xml version="1.0" encoding="UTF-8"?>
<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.0</modelVersion>
    <!--父项目版本-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <!--当前项目信息-->
    <groupId>wyq.test</groupId>
    <artifactId>springboot</artifactId>
    <version>1.0.0</version>
    <name>springboot</name>
    <description>test springboot 2.6.3 new characteristic</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <!--仅引用了starter和test组件-->
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <!--采用maven构建-->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

主要有以上四部分:父项目版本、当前项目信息、启用的组件,构建编译的方式

问题1:父项目都起了什么作用?

进入spring-boot-starter-parent父项目依赖可以看到父项目如下内容:

 作用:1、加载了spring-boot-dependences版本依赖的加载;

            2、设置了版本默认的jdk、编译目录、默认字符集、资源定界符

问题2:父项目加载了哪些依赖?

进入spring-boot-dependencies的pom文件,可以看到如下内容,

官网也有详细的清单:Dependency Versions

 当我们引用了默认的依赖时,因此可以不用写版本号,父依赖项目中已标注好了版本号

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值