码上敲享录 > SpringCloud实战教程 > idea创建springboot父工程

idea创建springboot父工程

章节目录下一章 2020-06-18已有1624人阅读 评论(0)

各个章节可能有关联关系,查找《SpringCloud实战教程》其他章节请参考:

http://www.yayihouse.com/yayishuwu/book/79


1. idea创建springboot父工程


File--》 New--》 Project...--》Spring Initializr--Project sdk选择jdk版本一般是1.8,所以你要按照1.8版本才好使用springcloudnext--》修改一下Groupcom.wlg.springcloudArtifactspringcloud--》next--》弹框的顶部可以切换springboot的版本我这里选的是2.3.1,在左边依赖列表中选择Web,在中间窗口选中Spring Web(有的idea是Spring Web Starter) --》 next--》Finish。

由于这个是主模块,所以我的pom.xml文件要修改一下packaging改成pom,把springcloud依赖放到dependencyManagement,其他子模块就可以继承springcloud的依赖:

<?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.3.1.RELEASE</version>
     <relativePath/> <!-- lookup parent from repository -->
  </parent>

  <groupId>com.wlg.springcloud</groupId>
  <artifactId>springcloud</artifactId>
  <version>0.0.1-SNAPSHOT</version>
   <packaging>pom</packaging>
  <name>springcloud</name>
  <description>Demo project for Spring Boot</description>

  <properties>
     <java.version>1.8</java.version>
     <spring-cloud.version>Hoxton.SR5</spring-cloud.version>
  </properties>

  <dependencies>
     <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>
        <exclusions>
           <exclusion>
              <groupId>org.junit.vintage</groupId>
              <artifactId>junit-vintage-engine</artifactId>
           </exclusion>
        </exclusions>
     </dependency>
  </dependencies>
   <dependencyManagement>
     <dependencies>
        <dependency>
           <groupId>org.springframework.cloud</groupId>
           <artifactId>spring-cloud-dependencies</artifactId>
           <version>${spring-cloud.version}</version>
           <type>pom</type>
           <scope>import</scope>
        </dependency>
     </dependencies>
  </dependencyManagement>
  <build>
     <plugins>
        <plugin>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
     </plugins>
  </build>

</project>


向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交