Maven 显示警告的POM.xml

Maven 显示警告的POM.xml,maven,spring-boot,Maven,Spring Boot,目前,我的POM.XML如下所示 dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency&

目前,我的POM.XML如下所示

dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>5.0.5.RELEASE</version>
</dependency>


  </dependencies>
  <build>
    <finalName>logger.Demo</finalName>
  </build>
</project>
依赖项>
朱尼特
朱尼特
3.8.1
测试
javax.servlet
servlet api
2.5
org.springframework
弹簧芯
5.0.5.1发布
记录器.演示
但是,当我在上面的pom.xml中附加下面的依赖项时,我得到了一个警告,并且我的几个类都失效了

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.2.RELEASE</version>
    </parent>

org.springframework.boot
spring启动程序父级
2.0.2.1发布
我在POM.xml中得到以下警告 1) 覆盖junit的托管版本4.12 2) 覆盖spring core的托管版本5.0.6.0版本

有人能解释一下为什么我会收到上述警告,以及我如何解决它吗?

描述了
父级
的功能。警告指出,您不应使用这些已在父级中定义但版本不同的依赖项

您可以删除上述依赖项的
version
部分,如

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>
    </dependency>

朱尼特
朱尼特
测试

你的意思是我应该保留spring boot starter的父依赖项吗?不,他是想从junit依赖项中删除
标记,以便版本由父依赖项控制。。。