Spring Boot 快速上手(10)Maven聚合工程

SpringBoot Maven聚合工程实战

架构场景

简单场景:电商系统
简单场景1
一套电商系统需要包含前台后台两套系统,此时,部分工具类和,持久层的代码是一样的,为了提高系统复用,采用maven 聚合工程的方式构建最合适不过了。

创建Maven 项目

新建maven父工程,删除src目录,在聚合工程中多模块,父工程仅作为模块即管理,场景通用,前台,后台模块,配置pom

创建模块:项目名字右键添加模块,创建maven项目
在这里插入图片描述
配置pom,自己创建的common通用模块会被其他两个模块使用,也要添加到依赖管理中

<?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>
    <packaging>pom</packaging>
    <modules>
        <module>common</module>
        <module>front</module>
        <module>back</module>
    </modules>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.2</version>
    </parent>
    <groupId>org.example</groupId>
    <artifactId>maven-demo-1</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <mybatis-plus.version>3.4.2</mybatis-plus.version>
        <mybatis-plus-generator.version>3.4.1</mybatis-plus-generator.version>
        <druid.version>1.2.6</druid.version>
        <freemarker.version>2.3.30</freemarker.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- 自己创建通用模块也需要管理 -->
            <dependency>
                <groupId>org.example</groupId>
                <artifactId>common</artifactId>
                <version>${project.version}
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值