1、使用Maven构建多模块项目

项目结构概览

  • flybiner-boot-all
  • flybiner-boot-api 第三方接口层
  • flybiner-boot-tool 基础工具层
  • flybiner-boot-model 实体类层
  • flybiner-boot-service 逻辑业务层
  • flybiner-boot-web web层

创建父工程




删除src目录


创建子模块

创建子模块flybiner-boot-api(用同样方式创建子模块flybiner-boot-tool、flybiner-boot-model、flybiner-boot-service、flybiner-boot-web )





创建完成后目录结构

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依赖 内部包-->
    <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 逻辑业务层 -->
            <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>
    <!-- 内部工具包 -->
    <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>
    <!-- 内部工具包 -->
    <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 逻辑业务层

<?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 逻辑业务层 -->
            <dependency>
                <groupId>cn.com.flybiner</groupId>
                <artifactId>flybiner-boot-service</artifactId>
            </dependency>
  </dependencies>
</project>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容