1、使用Maven構建多模塊項目

項目結構概覽

  • flybiner-boot-all
  • flybiner-boot-api 第三方接口層
  • flybiner-boot-tool 基礎工具層
  • flybiner-boot-model 實體類層
  • flybiner-boot-service 邏輯業(yè)務層
  • flybiner-boot-web web層

創(chuàng)建父工程




刪除src目錄


創(chuàng)建子模塊

創(chuàng)建子模塊flybiner-boot-api(用同樣方式創(chuàng)建子模塊flybiner-boot-tool、flybiner-boot-model、flybiner-boot-service、flybiner-boot-web )





創(chuàng)建完成后目錄結構

pom.xml配置

flybiner-boot-all 父親層

 <?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>
    <!-- spring-boot -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.4.RELEASE</version>
    </parent>
    <groupId>cn.com.flybiner</groupId>
    <artifactId>flybiner-boot-all</artifactId>
    <version>0.0.1</version>
    <packaging>pom</packaging>
    <properties>
        <flybiner.version>0.0.1</flybiner.version>
        <!-- java jre 版本 -->
        <java.version>1.8</java.version>
    </properties>
    <modules>
        <module>flybiner-boot-api</module>
        <module>flybiner-boot-tool</module>
        <module>flybiner-boot-model</module>
        <module>flybiner-boot-service</module>
        <module>flybiner-boot-web</module>
    </modules>
    <!-- maven依賴 內(nèi)部包-->
    <dependencyManagement>
        <dependencies>
            <!-- flybiner-boot-api 第三方接口層 -->
            <dependency>
                <groupId>cn.com.flybiner</groupId>
                <artifactId>flybiner-boot-api</artifactId>
                <version>${flybiner.version}</version>
                <scope>compile</scope>
            </dependency>
            <!-- flybiner-boot-tool 基礎工具層 -->
            <dependency>
                <groupId>cn.com.flybiner</groupId>
                <artifactId>flybiner-boot-tool</artifactId>
                <version>${flybiner.version}</version>
                <scope>compile</scope>
            </dependency>
            <!-- flybiner-boot-model 實體類層 -->
            <dependency>
                <groupId>cn.com.flybiner</groupId>
                <artifactId>flybiner-boot-model</artifactId>
                <version>${flybiner.version}</version>
                <scope>compile</scope>
            </dependency>
            <!-- flybiner-boot-service 邏輯業(yè)務層 -->
            <dependency>
                <groupId>cn.com.flybiner</groupId>
                <artifactId>flybiner-boot-service</artifactId>
                <version>${flybiner.version}</version>
                <scope>compile</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    
</project>

flybiner-boot-api 第三方接口層

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>cn.com.flybiner</groupId>
    <artifactId>flybiner-boot-all</artifactId>
    <version>0.0.1</version>
  </parent>
  <artifactId>flybiner-boot-api</artifactId>
  <name>flybiner-boot-api</name>
  <packaging>jar</packaging>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <!-- maven依賴 -->
  <dependencies>
    <!-- 內(nèi)部工具包 -->
    <dependency>
         <groupId>cn.com.flybiner</groupId>
         <artifactId>flybiner-boot-tool</artifactId>
     </dependency>
  </dependencies>
</project>

flybiner-boot-tool 基礎工具層

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>cn.com.flybiner</groupId>
    <artifactId>flybiner-boot-all</artifactId>
    <version>0.0.1</version>
  </parent>
  <artifactId>flybiner-boot-tool</artifactId>
  <name>flybiner-boot-tool</name>
  <packaging>jar</packaging>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <!-- 內(nèi)部工具包 -->
    <dependency>
          <groupId>cn.com.flybiner</groupId>
          <artifactId>flybiner-boot-tool</artifactId>
    </dependency>
  </dependencies>
</project>

flybiner-boot-model 實體類層

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>cn.com.flybiner</groupId>
    <artifactId>flybiner-boot-all</artifactId>
    <version>0.0.1</version>
  </parent>
  <artifactId>flybiner-boot-model</artifactId>
  <name>flybiner-boot-model</name>
  <packaging>jar</packaging>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
</project>

flybiner-boot-service 邏輯業(yè)務層

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
        <groupId>cn.com.flybiner</groupId>
        <artifactId>flybiner-boot-all</artifactId>
        <version>0.0.1</version>
  </parent>
  <artifactId>flybiner-boot-service</artifactId>
  <name>flybiner-boot-service</name>
  <packaging>jar</packaging>
  <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
        <!-- 基礎工具類包 -->
        <dependency>
                 <groupId>cn.com.flybiner</groupId>
                 <artifactId>flybiner-boot-tool</artifactId>
         </dependency>
         <!-- 實體類包 -->
        <dependency>
                 <groupId>cn.com.flybiner</groupId>
                 <artifactId>flybiner-boot-model</artifactId>
         </dependency>
  </dependencies>
</project>

flybiner-boot-web web層

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>cn.com.flybiner</groupId>
    <artifactId>flybiner-boot-all</artifactId>
    <version>0.0.1</version>
  </parent>
  <artifactId>flybiner-boot-web</artifactId>
  <name>flybiner-boot-web</name>
  <packaging>jar</packaging>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
            <!-- flybiner-boot-api 第三方接口層 -->
            <dependency>
                <groupId>cn.com.flybiner</groupId>
                <artifactId>flybiner-boot-api</artifactId>
            </dependency>
            <!-- flybiner-boot-tool 基礎工具層 -->
            <dependency>
                <groupId>cn.com.flybiner</groupId>
                <artifactId>flybiner-boot-tool</artifactId>
            </dependency>
            <!-- flybiner-boot-model 實體類層 -->
            <dependency>
                <groupId>cn.com.flybiner</groupId>
                <artifactId>flybiner-boot-model</artifactId>
            </dependency>
            <!-- flybiner-boot-service 邏輯業(yè)務層 -->
            <dependency>
                <groupId>cn.com.flybiner</groupId>
                <artifactId>flybiner-boot-service</artifactId>
            </dependency>
  </dependencies>
</project>
最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內(nèi)容