在没有父POM的情况下使用Spring Boot

夙愿已清 提交于 2020-01-14 09:57:52

不是每个人都喜欢继承spring-boot-starter-parent POM。 您可能拥有自己需要使用的公司标准父级,或者您可能更愿意明确声明所有Maven配置。

如果您不想使用spring-boot-starter-parent,您仍然可以通过使用scope = import依赖项来保持依赖项管理(但不是插件管理)的好处:

springboot

<dependencyManagement>
  <dependencies>
   <dependency>
      <!-- Import dependency management from Spring Boot -->
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-dependencies</artifactId>
     <version>1.5.10.RELEASE</version>
     <type>pom</type>
     <scope>import</scope>
   </dependency>
  </dependencies>
</dependencyManagement>

 

springcloud

<dependencyManagement>
  <dependencies>
       <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Dalston.SR1</version>
            <type>pom</type>
            <scope>import</scope>
            </dependency>
   </dependencies>
</dependencyManagement>

 

更改Java版本

<properties>
    <java.version>1.8</java.version>
</properties>

 

                                       

                                                                       JAVA程序猿成长之路

                          分享资源,记录程序猿成长点滴。专注于Java,Spring,SpringBoot,SpringCloud,分布式,微服务。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!