maven-多模块

DepencyManagement & dependencies区别
dependencies:即使在子项目中不写该依赖项,那么子项目仍然会从父项目中继承该依赖项(全部继承)dependencyManagement:里只是声明依赖,并不实现引入,因此子项目需要显示的声明需要用的依赖。如果不在子项目中声明依赖,是不会从父项目中继承下来的;只有在子项目中写了该依赖项,并且没有指定具体版本,才会从父项目中继承该项,并且version 和scope都读取自父pom;另外如果子项目中指定了版本号,那么会使用子项目中指定的jar版本。

工程目录结构

yingxue-service:服务层
yingxue-web:控制层

搭建步骤

由于是多模块,所以抽出一个yingxue-base-parent来管理子项目的公共的依赖。在我们项目顶层的POM文件中,我们会看到dependencyManagement元素。通过它元素来管理jar包的版本,让子项目中引用一个依赖而不用显示的列出版本号。Maven会沿着父子层次向上走,直到找到一个拥有dependencyManagement元素的项目,然后它就会使用在这个dependencyManagement元素中指定的版本号。

父类工程

  1. IDEA 工具栏选择菜单 File -> New -> Project...
  2. 选择Spring Initializr,Initializr默认选择Default,点击Next
  3. 删除无用的.mvn目录、src目录、mvnw及mvnw.cmd文件,最终只留.gitignore和pom.xml
image.png

子类工程

  1. 选择项目根目录yingxue-base-parent右键呼出菜单,选择New -> Module
  2. 选择Maven,点击Next
  3. 填写ArifactId,点击Next
  4. 同理添加【yingxue-service】子模块,最终得到项目目录结构如下图
image.png

整理父 pom 文件

  1. 修改 spring-boot-starter-parent 版本统一2.1.6.RELEASE
  2. 删除 dependencies 标签及其中的依赖,因为 Spring Boot 提供的父工程已包含,并且父 pom 原则上都是通过
    dependencyManagement 标签管理依赖包。
  3. 删除 build 标签及其中的所有内容,spring-boot-maven-plugin 插件作用是打一个可运行的包,多模块项目仅仅需要在入口类
    所在的模块添加打包插件,这里父模块不需要打包运行。而且该插件已被包含在 Spring Boot 提供的父工程中,这里删掉即可。
  4. 整理后的pom文件如下
<?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>
    <packaging>pom</packaging>
    <modules>
        <module>yingxue-web</module>
        <module>yingxue-service</module>
    </modules>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.yingxue.lesson</groupId>
    <artifactId>yingxue-base-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>yingxue-base-parent</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
</project>

运行项目

  1. yingxue-web pom 加入必须的依赖包
<dependencies>  
   <dependency>    
      <groupId>org.springframework.boot</groupId>    
      <artifactId>spring-boot-starter-web</artifactId>  
   </dependency>
</dependencies>
  1. 在yingxue-web层创建com.yingxue.lesson.web包(注意:这是多层目录结构并非单个目录名,com >>yingxue>>lesson>>web)并添加入口类WebApplication.java
@SpringBootApplication
public class WebApplication {
    public static void main(String[] args) {
        SpringApplication.run(WebApplication.class,args);
   }
}
  1. 在com.yingxue.lesson.web包中添加controller目录并新建一个Testcontroller,添加hello方法测试接口是否可以正常访问
@RestController
@RequestMapping("/test")
public class TestController {
    @GetMapping("/hello")
    public String hello(){
        return "Hello World";
   }
}
  1. 运行WebApplication类中的main方法启动项目,默认端口为8080,访问http://localhost:8080/test/hello得到如下效果
    image.png

配置模块间的依赖关系

通常 JAVA Web 项目会按照功能划分不同模块,模块之间通过依赖关系进行协作,下面将完善模块之间的依赖关系。

  1. 首先在父 pom 文件中使用「 dependencyManagement 」标签声明所有子模块依赖
   <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>yingxue-web</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>yingxue-service</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
  1. 其次在 yingxue-service 层中的 pom 文件中添加 spring-boot-starter-web 依赖
    <dependencies>
            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>
  1. 其次在 yingxue-web 层中的 pom 文件中添加 yingxue-service去掉spring-boot-starter-web依赖
        <dependency>
            <groupId>${parent.groupId}</groupId>
            <artifactId>yingxue-service</artifactId>
        </dependency>

web 层调用服务层接口测试

模块依赖关系配置完成之后,通过 web 层 测试下 service层的接口是否可以正常调用。

  1. 首先在 yingxue-service 层创建 com.yingxue.lesson包,添加 service 目录并在其中创建 UserService 接口类及 impl 目录(用于存放接口实现类)。
public interface UserService {
    String testService();
}
@Service
public class UserServiceImpl implements UserService {
    @Override
    public String testService() {
        return "testService";
   }
}
  1. TestController 通过 @Autowired 注解注入 UserService ,修改 TestController 的 test 方法使之调用 UserService 的testService方法
    @Autowired
    private UserService userService;
    @GetMapping("/hello")
    public String hello(){
        return userService.testService();
   }
  1. 再次运行 WebApplication 类中的 main 方法启动项目,发现如下报错


    image.png
  2. 在 WebApplication 入口类中增加包扫描,设置 @SpringBootApplication 注解中的 scanBasePackages 值为com.yingxue.lesson
@SpringBootApplication(scanBasePackages = "com.yingxue.lesson")
  1. 再次运行 WebApplication 类中的 main 方法启动项目 访问http://localhost:8080/test/hello得到如下效果
    image.png







Spring Boot 整合实战 Mybatis3 【多模块】

先创建一个根项目,删除无用的.mvn目录、src目录、mvnw及mvnw.cmd文件,最终只留.gitignore和pom.xml、然后创建module


image.png

项目目录

yingxue-service:服务层
yingxue-web:控制层
yingxue-dao:数据持久层
yingxue-vo:接收前端&响应端数据封装

整理根项目pom

  1. 修改 spring-boot-starter-parent 版本统一2.1.6.RELEASE
  2. 删除 dependencies 标签及其中的依赖,因为 Spring Boot 提供的父工程已包含,并且父 pom 原则上都是通过dependencyManagement 标签管理依赖包。
<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>yingxue-service</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>yingxue-dao</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>yingxue-web</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>yingxue-vo</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
  1. 删除 build 标签及其中的所有内容,spring-boot-maven-plugin 插件作用是打一个可运行的包,多模块项目仅仅需要在入口类。所在的模块添加打包插件,这里父模块不需要打包运行。而且该插件已被包含在 Spring Boot 提供的父工程中,这里删掉即可。
  2. 声明管理项目所需jar包
 <properties>
        <java.version>1.8</java.version>
        <mysql.version>5.1.47</mysql.version>
        <druid.version>1.1.10</druid.version>
        <mybatis.version>1.3.2</mybatis.version>
        <swagger2-version>2.9.2</swagger2-version>
    </properties>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql.version}</version>
            </dependency>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid-spring-boot-starter</artifactId>
                <version>${druid.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>${mybatis.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${swagger2-version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${swagger2-version}</version>
            </dependency>
  1. 整理后的pom文件如下
<?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>
    <packaging>pom</packaging>
    <modules>
        <module>yingxue-web</module>
        <module>yingxue-service</module>
        <module>yingxue-dao</module>
        <module>yingxue-vo</module>
    </modules>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
 <groupId>com.yingxue.lesson</groupId>
    <artifactId>mybatis-demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>mybatis-demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
        <mysql.version>5.1.47</mysql.version>
        <druid.version>1.1.10</druid.version>
        <mybatis.version>1.3.2</mybatis.version>
        <swagger2-version>2.9.2</swagger2-version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>yingxue-service</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>yingxue-dao</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>yingxue-web</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>yingxue-vo</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>${mybatis.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${swagger2-version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${swagger2-version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>

配置模块间的依赖关系

yingxue-vo

<?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">
    <parent>
        <artifactId>mybatis-demo</artifactId>
        <groupId>com.yingxue.lesson</groupId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <version>${parent.version}</version>
    <artifactId>yingxue-vo</artifactId>
</project>

yingxue-dao

<?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">
   <parent>
       <artifactId>mybatis-demo</artifactId>
       <groupId>com.yingxue.lesson</groupId>
       <version>0.0.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <version>${parent.version}</version>
   <artifactId>yingxue-dao</artifactId>
   <dependencies>
       <dependency>
           <groupId>mysql</groupId>
           <artifactId>mysql-connector-java</artifactId>
       </dependency>
       <dependency>
           <groupId>org.mybatis.spring.boot</groupId>
           <artifactId>mybatis-spring-boot-starter</artifactId>
       </dependency>
       <dependency>
           <groupId>com.yingxue.lesson</groupId>
           <artifactId>yingxue-vo</artifactId>
       </dependency>
       <dependency>
           <groupId>com.alibaba</groupId>
           <artifactId>druid-spring-boot-starter</artifactId>
       </dependency>
   </dependencies>
</project>

yingxue-service

<?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">
   <parent>
       <artifactId>mybatis-demo</artifactId>
       <groupId>com.yingxue.lesson</groupId>
       <version>0.0.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <version>${parent.version}</version>
   <artifactId>yingxue-service</artifactId>
   <dependencies>
       <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-web</artifactId>
       </dependency>
       <dependency>
           <groupId>com.yingxue.lesson</groupId>
           <artifactId>yingxue-dao</artifactId>
       </dependency>
   </dependencies>

yingxue-web

<?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">
    <parent>
        <artifactId>mybatis-demo</artifactId>
        <groupId>com.yingxue.lesson</groupId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>yingxue-web</artifactId>
    <version>${parent.version}</version>
    <dependencies>
        <dependency>
            <groupId>com.yingxue.lesson</groupId>
            <artifactId>yingxue-service</artifactId>
        </dependency>
    </dependencies>
</project>
最后yingxue-web application.properties 加入链接池配置




生产环境商城demo:

image.png

image.png

common 为起点(不依赖任何模块) ---》其他中间模块随便互相调用 ---》 combination 为出口(把其它模块都依赖进来【除了search】)

父项目:lecshop_v3

<?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>
    <modules>
        <module>lecshop_api_modules</module>
        <module>lecshop_base_modules</module>
    </modules>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.lecshop</groupId>
    <artifactId>lecshop</artifactId>
    <version>3.0.0-SNAPSHOT</version>
    <name>lecshop_v3</name>
    <description>Demo project for Spring Boot</description>

    <packaging>pom</packaging>


    <properties>
        <java.version>1.8</java.version>
        <druid.version>1.1.16</druid.version>
        <elasticsearch.version>5.5.0</elasticsearch.version>
        <mybatis.version>3.4.0</mybatis.version>
        <docker.image.prefix>lecshop</docker.image.prefix>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework.data.lecshop</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
            <version>3.0.8.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-pool2</artifactId>
        </dependency>

        <!-- redis-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>

        <!--web-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.0.0</version>
        </dependency>

        <!--mysql-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

        <!--lombok-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

        <!--druid 数据源-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>${druid.version}</version>
        </dependency>

        <!--jwt-->
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.7.0</version>
        </dependency>

        <!-- AOP 切面 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
            <version>2.0.3.RELEASE</version>
        </dependency>

        <!--swagger2 -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
        </dependency>

    </dependencies>

    <repositories>
        <repository>
            <id>nexus</id>
            <name>local private nexus</name>
            <url>http://118.178.58.102:9888/nexus/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
        <repository>
            <id>nexus repository</id>
            <name>intranet public groups</name>
            <url>http://118.178.58.102:9888/nexus/content/groups/public</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

</project>

部署包 lecshop_api_modules

<?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">
    <parent>
        <artifactId>lecshop</artifactId>
        <groupId>com.lecshop</groupId>
        <version>3.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>lecshop_api_modules</artifactId>
    <packaging>pom</packaging>
    <modules>
        <module>lecshop_web_admin</module>
        <module>lecshop_web_app</module>
        <module>lecshop_web_applets</module>
        <module>lecshop_web_store</module>
        <module>lecshop_web_mobile</module>
        <module>lecshop_web_pc</module>
    </modules>
</project>

基础模块 lecshop_base_modules

<?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">
    <parent>
        <artifactId>lecshop</artifactId>
        <groupId>com.lecshop</groupId>
        <version>3.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>lecshop_base_modules</artifactId>
    <packaging>pom</packaging>
    <modules>
        <module>lecshop_common</module>
        <module>lecshop_system</module>
        <module>lecshop_spu</module>
        <module>lecshop_customer</module>
        <module>lecshop_order</module>
        <module>lecshop_marketing</module>
        <module>lecshop_search</module>
        <module>lecshop_site</module>
        <module>lecshop_shopping_cart</module>
        <module>lecshop_combination</module>
        <module>lecshop_points_mall</module>
    </modules>
</project>

平台管理端 lecshop_web_admin

<?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">
    <parent>
        <artifactId>lecshop_api_modules</artifactId>
        <groupId>com.lecshop</groupId>
        <version>3.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>lecshop_web_admin</artifactId>
    <packaging>jar</packaging>


    <dependencies>

        <dependency>
            <artifactId>lecshop_combination</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <imageName>${docker.image.prefix}/${project.artifactId}</imageName>
                    <dockerDirectory>src/main/docker</dockerDirectory>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

app后端 lecshop_web_app

<?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">
    <parent>
        <artifactId>lecshop_api_modules</artifactId>
        <groupId>com.lecshop</groupId>
        <version>3.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>lecshop_web_app</artifactId>
    <packaging>jar</packaging>


    <dependencies>

        <dependency>
            <artifactId>lecshop_combination</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>

    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <imageName>${docker.image.prefix}/${project.artifactId}</imageName>
                    <dockerDirectory>src/main/docker</dockerDirectory>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

小程序后端

<?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">
    <parent>
        <artifactId>lecshop_api_modules</artifactId>
        <groupId>com.lecshop</groupId>
        <version>3.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>lecshop_web_applets</artifactId>
    <packaging>jar</packaging>
    <dependencies>

        <dependency>
            <artifactId>lecshop_combination</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>

    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <imageName>${docker.image.prefix}/${project.artifactId}</imageName>
                    <dockerDirectory>src/main/docker</dockerDirectory>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


聚合模块 lecshop_combination

<?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">
    <parent>
        <artifactId>lecshop_base_modules</artifactId>
        <groupId>com.lecshop</groupId>
        <version>3.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>lecshop_combination</artifactId>
    <dependencies>
        <dependency>
            <artifactId>lecshop_customer</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <artifactId>lecshop_common</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <artifactId>lecshop_system</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <artifactId>lecshop_spu</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <artifactId>lecshop_order</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <artifactId>lecshop_site</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <artifactId>lecshop_marketing</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <artifactId>lecshop_shopping_cart</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.lecshop</groupId>
            <artifactId>lecshop_points_mall</artifactId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>

公共模块 lecshop_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">
    <parent>
        <artifactId>lecshop_base_modules</artifactId>
        <groupId>com.lecshop</groupId>
        <version>3.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>lecshop_common</artifactId>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>



        <!--security-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>


        <!--  又拍云 -->
        <dependency>
            <groupId>com</groupId>
            <artifactId>upyun</artifactId>
            <version>1.0.0</version>
        </dependency>


        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.1</version>
        </dependency>

        <!--  验证码插件 -->
        <dependency>
            <groupId>com.github.penggle</groupId>
            <artifactId>kaptcha</artifactId>
            <version>2.3.2</version>
        </dependency>


        <!--  poi execle -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.16</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.1</version>
        </dependency>
        <!-- 支付宝支付 jar -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.3</version>
        </dependency>
        <!-- 银联支付 jar -->
        <dependency>
            <groupId>com.unionpay.acp</groupId>
            <artifactId>upacp_sdk</artifactId>
            <version>1.0.0</version>
        </dependency>
        <!--dom4j -->
        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>1.6.1</version>
        </dependency>


        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk16</artifactId>
            <version>1.46</version>
        </dependency>

        <!-- 生成二维码的jar -->
        <dependency>
            <groupId>com.lecshop</groupId>
            <artifactId>zxing</artifactId>
            <version>0.0.1</version>
        </dependency>

        <!-- 啊里支付 -->
        <dependency>
            <groupId>com.lecshop</groupId>
            <artifactId>alipay</artifactId>
            <version>1.0.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>

        <!-- 短信发送-->
        <dependency>
            <groupId>com.lecshop</groupId>
            <artifactId>smsdys</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.lecshop</groupId>
            <artifactId>smscore</artifactId>
            <version>3.2.3</version>
        </dependency>


        <dependency>
            <groupId>com.taobao</groupId>
            <artifactId>alidayu</artifactId>
            <version>1.0</version>
        </dependency>

        <!-- 邮件-->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.4</version>
        </dependency>

    </dependencies>
</project>

会员模块 lecshop_customer

<?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">
    <parent>
        <artifactId>lecshop_base_modules</artifactId>
        <groupId>com.lecshop</groupId>
        <version>3.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>lecshop_customer</artifactId>
    <dependencies>
        <dependency>
            <artifactId>lecshop_spu</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.lecshop</groupId>
            <artifactId>lecshop_system</artifactId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>

促销模块 lecshop_marketing

<?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">
    <parent>
        <artifactId>lecshop_base_modules</artifactId>
        <groupId>com.lecshop</groupId>
        <version>3.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>lecshop_marketing</artifactId>
    <dependencies>
        <dependency>
            <artifactId>lecshop_common</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <artifactId>lecshop_spu</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>

订单模块 lecshop_order

<?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">
    <parent>
        <artifactId>lecshop_base_modules</artifactId>
        <groupId>com.lecshop</groupId>
        <version>3.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>lecshop_order</artifactId>


    <dependencies>
        <dependency>
            <artifactId>lecshop_common</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>

搜索模块 lecshop_search

<?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">
    <parent>
        <artifactId>lecshop_base_modules</artifactId>
        <groupId>com.lecshop</groupId>
        <version>3.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>lecshop_search</artifactId>


    <dependencies>

        <!--spring es 搜索引擎 -->
        <dependency>
            <groupId>org.springframework.data.lecshop</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
            <version>3.0.8.RELEASE</version>
        </dependency>


        <dependency>
            <artifactId>lecshop_common</artifactId>
            <groupId>com.lecshop</groupId>
            <version>3.0.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

</project>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 213,992评论 6 493
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,212评论 3 388
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 159,535评论 0 349
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,197评论 1 287
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,310评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,383评论 1 292
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,409评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,191评论 0 269
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,621评论 1 306
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,910评论 2 328
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,084评论 1 342
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,763评论 4 337
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,403评论 3 322
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,083评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,318评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,946评论 2 365
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,967评论 2 351