使用SpringBoot自定义父工程

1.使用idea创建一个空项目

2.之后创建一个parent项目,添加如下

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

 <dependencyManagement>
    <dependencies>
      <!--引入springboot-->
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.0.4.RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

3.创建一个子项目,引入自定义parent,之后可以正常引入坐标即可

 <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
 </dependency>

 <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
 </dependency>

猜你喜欢

转载自blog.csdn.net/weixin_40333020/article/details/82458596