• e3mall工程搭建


    1. e3mall项目架构

    e3-parent:父工程,打包方式pom,管理jar包的版本号。

        |           项目中所有工程都应该继承父工程。

    |--e3-common:通用的工具类通用的pojo。打包方式jar

    |--e3-manager:服务层工程。聚合工程。Pom工程

    |--e3-manager-dao:打包方式jar

    |--e3-manager-pojo:打包方式jar

    |--e3-manager-interface:打包方式jar

    |--e3-manager-service:打包方式:jar

        |--e3-manager-web:表现层工程。打包方式war

    2. 新建parent父工程

     

    接下里pom文件里统一管理jar包版本和插件(内容有点多,不再粘贴)

    3. 新建e3-common工程(通用的工具类、通用的pojo。打包方式jar。需要继承父工程。

    pom文件添加通用工具类依赖

    <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>cn.e3mall</groupId>

              <artifactId>e3-parent</artifactId>

              <version>0.0.1-SNAPSHOT</version>

         </parent>

         <groupId>cn.e3mall</groupId>

         <artifactId>e3-common</artifactId>

         <version>0.0.1-SNAPSHOT</version>

         <dependencies>

              <!-- 时间操作组件 -->

              <dependency>

                   <groupId>joda-time</groupId>

                   <artifactId>joda-time</artifactId>

              </dependency>

              <!-- Apache工具组件 -->

              <dependency>

                   <groupId>org.apache.commons</groupId>

                   <artifactId>commons-lang3</artifactId>

              </dependency>

              <dependency>

                   <groupId>org.apache.commons</groupId>

                   <artifactId>commons-io</artifactId>

              </dependency>

              <dependency>

                   <groupId>commons-net</groupId>

                   <artifactId>commons-net</artifactId>

              </dependency>

              <!-- Jackson Json处理工具包 -->

              <dependency>

                   <groupId>com.fasterxml.jackson.core</groupId>

                   <artifactId>jackson-databind</artifactId>

              </dependency>

              <!-- httpclient -->

              <dependency>

                   <groupId>org.apache.httpcomponents</groupId>

                   <artifactId>httpclient</artifactId>

              </dependency>

              <!-- quartz任务调度框架 -->

              <dependency>

                   <groupId>org.quartz-scheduler</groupId>

                   <artifactId>quartz</artifactId>

              </dependency>

              <!-- 单元测试 -->

              <dependency>

                   <groupId>junit</groupId>

                   <artifactId>junit</artifactId>

                   <scope>test</scope>

              </dependency>

              <!-- 日志处理 -->

              <dependency>

                   <groupId>org.slf4j</groupId>

                   <artifactId>slf4j-log4j12</artifactId>

              </dependency>

         </dependencies>

    </project>

     

    4. 新建e3-manager子工程及其下的子模块

    1、新建e3-manager子工程

    pom文件:

    <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>cn.e3mall</groupId>

              <artifactId>e3-parent</artifactId>

              <version>0.0.1-SNAPSHOT</version>

         </parent>

         <groupId>cn.e3mall</groupId>

         <artifactId>e3-manager</artifactId>

         <version>0.0.1-SNAPSHOT</version>

         <packaging>pom</packaging>

         <dependencies>

              <dependency>

                   <groupId>cn.e3mall</groupId>

                   <artifactId>e3-common</artifactId>

                   <version>0.0.1-SNAPSHOT</version>

              </dependency>

         </dependencies>

    </project>

    2、创建e3-manager-pojo子模块,pom文件:

    <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>cn.e3mall</groupId>

              <artifactId>e3-manager</artifactId>

              <version>0.0.1-SNAPSHOT</version>

         </parent>

         <artifactId>e3-manager-pojo</artifactId>

    </project>

    3、创建e3-manager-dao子模块,pom文件:

    <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>cn.e3mall</groupId>

              <artifactId>e3-manager</artifactId>

              <version>0.0.1-SNAPSHOT</version>

         </parent>

         <artifactId>e3-manager-dao</artifactId>

         <dependencies>

              <dependency>

                   <groupId>cn.e3mall</groupId>

                   <artifactId>e3-manager-pojo</artifactId>

                   <version>0.0.1-SNAPSHOT</version>

              </dependency>

              <!-- 添加对mybatis的依赖 -->

              <dependency>

                   <groupId>org.mybatis</groupId>

                   <artifactId>mybatis</artifactId>

              </dependency>

              <dependency>

                   <groupId>org.mybatis</groupId>

                   <artifactId>mybatis-spring</artifactId>

              </dependency>

              <dependency>

                   <groupId>com.github.miemiedev</groupId>

                   <artifactId>mybatis-paginator</artifactId>

              </dependency>

              <dependency>

                   <groupId>com.github.pagehelper</groupId>

                   <artifactId>pagehelper</artifactId>

              </dependency>

              <!-- MySql -->

              <dependency>

                   <groupId>mysql</groupId>

                   <artifactId>mysql-connector-java</artifactId>

              </dependency>

              <!-- 连接池 -->

              <dependency>

                   <groupId>com.alibaba</groupId>

                   <artifactId>druid</artifactId>

              </dependency>

         </dependencies>

    </project>

    4、创建e3-manager-interface子模块,pom文件:

    <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>cn.e3mall</groupId>

              <artifactId>e3-manager</artifactId>

              <version>0.0.1-SNAPSHOT</version>

         </parent>

         <artifactId>e3-manager-interface</artifactId>

         <dependencies>

              <dependency>

                   <groupId>cn.e3mall</groupId>

                   <artifactId>e3-manager-pojo</artifactId>

                   <version>0.0.1-SNAPSHOT</version>

              </dependency>

         </dependencies>

    </project>

    5、创建e3-manager-service子模块,pom文件:

    <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>cn.e3mall</groupId>

              <artifactId>e3-manager</artifactId>

              <version>0.0.1-SNAPSHOT</version>

         </parent>

         <artifactId>e3-manager-service</artifactId>

         <dependencies>

              <dependency>

                   <groupId>cn.e3mall</groupId>

                   <artifactId>e3-manager-dao</artifactId>

                   <version>0.0.1-SNAPSHOT</version>

              </dependency>

              <dependency>

                   <groupId>cn.e3mall</groupId>

                   <artifactId>e3-manager-interface</artifactId>

                   <version>0.0.1-SNAPSHOT</version>

              </dependency>

              <!-- spring的依赖 -->

              <!-- Spring -->

              <dependency>

                   <groupId>org.springframework</groupId>

                   <artifactId>spring-context</artifactId>

              </dependency>

              <dependency>

                   <groupId>org.springframework</groupId>

                   <artifactId>spring-beans</artifactId>

              </dependency>

              <dependency>

                   <groupId>org.springframework</groupId>

                   <artifactId>spring-webmvc</artifactId>

              </dependency>

              <dependency>

                   <groupId>org.springframework</groupId>

                   <artifactId>spring-jdbc</artifactId>

              </dependency>

              <dependency>

                   <groupId>org.springframework</groupId>

                   <artifactId>spring-aspects</artifactId>

              </dependency>

              <dependency>

                   <groupId>org.springframework</groupId>

                   <artifactId>spring-jms</artifactId>

              </dependency>

              <dependency>

                   <groupId>org.springframework</groupId>

                   <artifactId>spring-context-support</artifactId>

              </dependency>

         </dependencies>

    </project>

     6、创建e3-manager-web子模块:

    pom文件:

    <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>cn.e3mall</groupId>

              <artifactId>e3-manager</artifactId>

              <version>0.0.1-SNAPSHOT</version>

         </parent>

         <artifactId>e3-manager-web</artifactId>

         <packaging>war</packaging>

         <dependencies>

              <dependency>

              <groupId>cn.e3mall</groupId>

              <artifactId>e3-manager-service</artifactId>

              <version>0.0.1-SNAPSHOT</version>

              </dependency>

              <!-- JSP相关 -->

              <dependency>

                   <groupId>jstl</groupId>

                   <artifactId>jstl</artifactId>

              </dependency>

              <dependency>

                   <groupId>javax.servlet</groupId>

                   <artifactId>servlet-api</artifactId>

                   <scope>provided</scope>

              </dependency>

              <dependency>

                   <groupId>javax.servlet</groupId>

                   <artifactId>jsp-api</artifactId>

                   <scope>provided</scope>

              </dependency>

         </dependencies>

    </project>

    7、由于打包方式为war需要补全目录结构,需要在webapp目录下添加WEB-INF目录,和web.xml文件:

     

    <?xml version="1.0" encoding="UTF-8"?>

    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xmlns="http://java.sun.com/xml/ns/javaee"

         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

         id="WebApp_ID" version="2.5">

         <display-name>e3-manager-web</display-name>

         <welcome-file-list>

              <welcome-file>index.jsp</welcome-file>

         </welcome-file-list>

    </web-app>

     

    5. 测试启动工程

    1、需要在e3-manager 的pom工程中,配置tomcat插件。启动的端口号,和工程名称。

    在e3-manager的pom文件中添加如下配置:

    <!-- 配置tomcat插件 -->

         <build>

              <plugins>

                   <plugin>

                        <groupId>org.apache.tomcat.maven</groupId>

                        <artifactId>tomcat7-maven-plugin</artifactId>

                        <configuration>

                             <port>8080</port>

                             <path>/</path>

                        </configuration>

                   </plugin>

              </plugins>

         </build>

    2、启动tomcat插件:

    clean tomcat7:run

    先把e3-parent、e3-common安装到本地仓库。然后再启动。

  • 相关阅读:
    Centos7 系统别名设置
    C#编程 JSON操作
    C#编程 XML文档
    C#编程 socket编程之TcpClient,TcpListener,UdpClient
    C#编程 socket编程之udp服务器端和客户端
    C#编程 socket编程之unity聊天室
    C#编程 socket编程之tcp服务器端和客户端
    C#编程 线程,任务和同步(2) 开启线程
    C#编程 线程,任务和同步(1) 基础认识
    C#编程 LINQ查询
  • 原文地址:https://www.cnblogs.com/naixin007/p/9865565.html
Copyright © 2020-2023  润新知