玩轉 Spring boot 系列:(一)使用 Idea 搭建 Spring boot Maven 多模塊父子工程(圖解)

前言:

隨着JAVA技術棧的演進,Spring boot、Spring Cloud 等下一代框架越發的火熱,本系列就帶領着完成一個企業級 Spring Boot 框架的搭建以及應用。 代碼地址:子父工程demo

1、新建 project

2、創建工程的信息:如圖

3、因爲建立的是多模塊子父工程,所以項目新建完之後,要刪除一些不用的模塊。如圖:

4、建立子模塊

5、之後點擊 NEXT,會出現如下圖所示:

6、再建立一個子模塊,名字爲 basic,步驟就不演示了。最終 maven 多模塊子父工程如圖:

將maven 多模塊項目 更改爲 spring boot 項目,需要更改父模塊的 pom.xml 文件,如圖:

完整 pom.xml 如圖所示:

<?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 http://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.2.7.RELEASE</version>
        <relativePath/>
    </parent>

    <groupId>com.liren</groupId>
    <artifactId>platform</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>

    <modules>
        <module>admin</module>
        <module>basic</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

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

</project>

創作不易,各位的支持和認可,就是我創作的最大動力,

【轉載請聯繫本人】 如有問題,請聯繫我。歡迎斧正!不勝感激 !

求點贊👍 求關注❤️ 求分享👥 求留言📪

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章