上一篇我们介绍《springmvc+mybatis+dubbo+zookeeper分布式架构 整合 - maven模块规划》,从今天开始,我们将对代码的每一个构建做详细的记录,能够帮助大家如何快速构建dubbo分布式企业架构。

导语:在dubbo分布式架构构建之前,请大家务必掌握maven的相关技能,因为架构中大量使用maven技术进行项目构建,有不熟的朋友可以在网上找一些资料学习。

1. 准备技能

开发语言:JAVA/J2EE

项目构建管理:Maven

持续集成方案:Jenkins

SOA服务: Dubbo、zookeeper、Restful

SSO单点登录:Redis、JWT、Restful

分布式缓存:Redis

分布式消息中间件:zookeeper+kafka

分布式文件:FastDFS

数据库连接池:Alibaba Druid

核心框架:Spring framework、Spring MVC、Apache Shiro、MyBatis

前端框架:Bootstrap + html5 + CSS3

2. 创建maven基础项目,其中只需要配置pom.xml文件和打包的文件即可,代码如下:

    <span style="font-size: 16px;"><?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>  <groupId>com.sml.sz</groupId>  <artifactId>ant-project</artifactId>  <version>1.0.0</version>  <packaging>pom</packaging>  <name>ant-project</name>  <url>http://maven.apache.org</url>  <inceptionYear>2015-2016</inceptionYear>  <properties>  <!-- 框架通用包版本设置 -->  <spring.version>4.2.2.RELEASE</spring.version>  <validator.version>5.1.1.Final</validator.version>  <mybatis.version>3.2.8</mybatis.version>  <mybatis-spring.version>1.2.2</mybatis-spring.version>  <shiro.version>1.2.3</shiro.version>  <druid.version>1.0.11</druid.version>  <ehcache.version>2.6.9</ehcache.version>  <ehcache-web.version>2.0.4</ehcache-web.version>  <sitemesh.version>2.4.2</sitemesh.version>  <activiti.version>5.15.1</activiti.version>  <wink.version>1.4</wink.version>  <sso.client.version>3.2.1</sso.client.version>  <!-- 通用工具包版本设置 -->  <slf4j.version>1.7.7</slf4j.version>  <commons-lang3.version>3.3.2</commons-lang3.version>  <commons-io.version>2.4</commons-io.version>  <commons-codec.version>1.9</commons-codec.version>  <commons-fileupload.version>1.3.1</commons-fileupload.version>  <commons-beanutils.version>1.9.1</commons-beanutils.version>  <jackson.version>2.2.3</jackson.version>  <fastjson.version>1.1.40</fastjson.version>  <xstream.version>1.4.7</xstream.version>  <guava.version>17.0</guava.version>  <dozer.version>5.5.1</dozer.version>  <email.version>1.4.7</email.version>  <poi.version>3.9</poi.version>  <freemarker.version>2.3.20</freemarker.version>  <!-- 基础环境设置 -->  <jdk.version>1.6</jdk.version>  <tomcat.version>2.2</tomcat.version>  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  <downloadSources>true</downloadSources>  <!-- jdbc驱动版本设置 -->  <mysql.driver.version>5.1.30</mysql.driver.version>  </properties>  <dependencies>  <!-- 单元测试 -->  <dependency>  <groupId>junit</groupId>  <artifactId>junit</artifactId>  <version>4.11</version>  <scope>test</scope>  </dependency>  <!-- Tomcat 如果存在就不需要将servlet-api.jar、jsp-api.jar一起打包 -->  <dependency>  <groupId>javax.servlet</groupId>  <artifactId>servlet-api</artifactId>  <version>2.5</version>  <scope>provided</scope>  </dependency>  <dependency>  <groupId>javax.servlet.jsp</groupId>  <artifactId>jsp-api</artifactId>  <version>2.1</version>  <scope>provided</scope>  </dependency>  </dependencies>  <dependencyManagement>  <dependencies>  <!-- ant 工具jar -->  <dependency>  <groupId>com.sml.sz</groupId>  <artifactId>ant-utils</artifactId>  <version>${project.version}</version>  </dependency>  <!-- ant 公共配置jar -->  <dependency>  <groupId>com.sml.sz</groupId>  <artifactId>ant-config</artifactId>  <version>${project.version}</version>  </dependency>  <!-- ant 核心框架jar -->  <dependency>  <groupId>com.sml.sz</groupId>  <artifactId>ant-framework</artifactId>  <version>${project.version}</version>  </dependency>  <!-- ant 代码自动生成业务jar -->  <dependency>  <groupId>com.sml.sz</groupId>  <artifactId>ant-core-gen</artifactId>  <version>${project.version}</version>  </dependency>  <!-- ant 会员业务jar -->  <dependency>  <groupId>com.sml.sz</groupId>  <artifactId>ant-core-member</artifactId>  <version>${project.version}</version>  </dependency>  <!-- ant RestFul服务系統 -->  <dependency>  <groupId>com.sml.sz</groupId>  <artifactId>ant-web-service</artifactId>  <version>${project.version}</version>  </dependency>  <!-- ant admin后台管理系統 -->  <dependency>  <groupId>com.sml.sz</groupId>  <artifactId>ant-web-admin</artifactId>  <version>${project.version}</version>  </dependency>  <!-- dubbo begin -->  <dependency>  <groupId>com.sml.sz</groupId>  <artifactId>ant-member-facade</artifactId>  <version>${project.version}</version>  </dependency>  <dependency>  <groupId>com.sml.sz</groupId>  <artifactId>ant-member-service</artifactId>  <version>${project.version}</version>  </dependency>  <!-- dubbo end -->  </dependencies>  </dependencyManagement>  <build>  <pluginManagement>  <plugins>  <!-- maven -->  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-antrun-plugin</artifactId>  <version>1.7</version>  </plugin>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-compiler-plugin</artifactId>  <version>2.3.2</version>  <configuration>  <source>1.5</source>  <target>1.5</target>  <!-- 去除临时文件 -->  <excludes>  <exclude>**/*.keep</exclude>  <exclude>**/*.keep.*</exclude>  <exclude>*.bak</exclude>  <exclude>*.contrib</exclude>  </excludes>  <showDeprecation>true</showDeprecation>  <compilerArgument>-Xlint:unchecked,deprecation,fallthrough,finally</compilerArgument>  <fork>true</fork>  <encoding>${project.build.sourceEncoding}</encoding>  </configuration>  </plugin>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-jar-plugin</artifactId>  <version>2.3.1</version>  <executions>  <execution>  <goals>  <goal>test-jar</goal>  </goals>  </execution>  </executions>  <configuration>  <archive>  <manifest>  <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>  <addDefaultImplementationEntries>true</addDefaultImplementationEntries>  </manifest>  </archive>  </configuration>  </plugin>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-release-plugin</artifactId>  <version>2.1</version>  </plugin>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-resources-plugin</artifactId>  <version>2.4.3</version>  <configuration>  <!-- 去除临时文件 -->  <excludes>  <exclude>**/*.keep</exclude>  <exclude>**/*.keep.*</exclude>  <exclude>*.bak</exclude>  <exclude>*.contrib</exclude>  </excludes>  </configuration>  </plugin>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-site-plugin</artifactId>  <version>2.1.1</version>  <configuration>  <inputEncoding>${project.build.sourceEncoding}</inputEncoding>  <outputEncoding>${project.build.sourceEncoding}</outputEncoding>  </configuration>  </plugin>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-source-plugin</artifactId>  <version>2.1.2</version>  <executions>  <execution>  <id>attach-sources</id>  <goals>  <goal>jar</goal>  <goal>test-jar</goal>  </goals>  </execution>  </executions>  <configuration>  <excludeResources>false</excludeResources>  <attach>true</attach>  </configuration>  </plugin>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-war-plugin</artifactId>  <version>2.4</version>  </plugin>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-ear-plugin</artifactId>  <version>2.9</version>  <configuration>  <version>5</version>  </configuration>  </plugin>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-surefire-plugin</artifactId>  <version>2.6</version>  <configuration>  <testFailureIgnore>true</testFailureIgnore>  </configuration>  </plugin>  <plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-surefire-report-plugin</artifactId>  <version>2.6</version>  <configuration>  <parallel>both</parallel>  </configuration>  </plugin>  <plugin>  <groupId>com.google.code.maven-replacer-plugin</groupId>  <artifactId>replacer</artifactId>  <version>1.5.1</version>  <executions>  <execution>  <phase>prepare-package</phase>  <goals>  <goal>replace</goal>  </goals>  </execution>  </executions>  </plugin>  <!-- 读取系统配置的properties文件,避免写入profile中,各自模块使用的时候注意修改路径 -->  <plugin>  <groupId>org.kuali.maven.plugins</groupId>  <artifactId>properties-maven-plugin</artifactId>  <version>2.0.1</version>  <configuration>  <locations>  <location>${basedir}/../project_${profile}.properties</location>  </locations>  </configuration>  <executions>  <execution>  <phase>prepare-package</phase>  <goals>  <goal>read-project-properties</goal>  </goals>  </execution>  </executions>  </plugin>  </plugins>  </pluginManagement>  </build>  <profiles>  <profile>  <id>dev</id>  <activation>  <activeByDefault>true</activeByDefault>  </activation>  <properties>  <project>  dev  </project>  </properties>  </profile>  <profile>  <id>sit</id>  <activation>  <property>  <name>environment.type</name>  <value>sit</value>  </property>  </activation>  <properties>  <project>  sit  </project>  </properties>  </profile>  <profile>  <id>uat</id>  <activation>  <property>  <name>environment.type</name>  <value>uat</value>  </property>  </activation>  <properties>  <project>  uat  </project>  </properties>  </profile>  <profile>  <id>performance</id>  <activation>  <property>  <name>environment.type</name>  <value>performance</value>  </property>  </activation>  <properties>  <project>  performance  </project>  </properties>  </profile>  <profile>  <id>production</id>  <activation>  <property>  <name>environment.type</name>  <value>production</value>  </property>  </activation>  <properties>  <project>  production  </project>  </properties>  </profile>  </profiles>  <modules>  <!-- ant 工具jar -->  <module>ant-utils</module>  <!-- ant 公共配置jar -->  <module>ant-config</module>  <!-- ant 核心框架jar -->  <module>ant-framework</module>  <!-- ant 代码自动生成业务jar -->  <module>ant-core-gen</module>  <!-- ant 会员业务jar -->  <module>ant-core-member</module>  <!-- ant admin后台管理系統 -->  <module>ant-web-admin</module>  <!-- ant Restful服务管理系統 -->  <module>ant-web-service</module>  <!-- ant member Dubbo服务接口 -->  <module>ant-member-facade</module>  <!-- ant member Dubbo服务提供者 -->  <module>ant-member-service</module>  </modules>  <description>ant平台的super工程,定义了整合ant项目群的基本信息,以及依赖项和插件信息、maven的自定义信息</description>  </project></span>

  

2. 创建打包脚本:测试、生成等

build_SIT-no-test.bat

    <span style="font-size: 16px;">set MAVEN_OPTS= -Xms128 -Xmx256m  mvn clean package --define maven.test.skip=true --define environment.type=sit</span>

  build_UAT-no-test.bat

    <span style="font-size: 16px;">set MAVEN_OPTS= -Xms128 -Xmx256m  mvn clean package --define maven.test.skip=true --define environment.type=uat</span>

  build_PROD-no-test.bat

    <span style="font-size: 16px;">set MAVEN_OPTS= -Xms128 -Xmx256m  mvn clean package --define maven.test.skip=true --define environment.type=pro</span>

  

3. 创建打包的properties文件:

project_sit.properties

解释: 里面可以配置打包的信息,比如:ip、域名、包名等

4. 代码结构如下:

5.架构代码如下:

资料和源码来源

转载于:https://www.cnblogs.com/xiamudaren/p/8434390.html

(五)springmvc+mybatis+dubbo+zookeeper分布式架构 整合 - maven构建根项目相关推荐

  1. (一)springmvc+mybatis+dubbo+zookeeper分布式架构 整合 - 平台导语简介

    导语: 怎么搭建一套满足企业未来发展的通用架构平台?现在分布式.微服务.云平台的口号是如此的响亮,技术更新是如此的迅速,很多架构师选择使用dubbo.spring cloud的方案去帮助企业搭建分布式 ...

  2. (十二)springmvc+mybatis+dubbo+zookeeper分布式架构 整合 - zookeeper注册中心安装

    今天我们来学习基于zookeeper注册中心的安装. 注册中心 1.建议使用dubbo-2.3.3以上版本的使用zookeeper注册中心客户端 2.Zookeeper是Apache Hadoop的子 ...

  3. springmvc+mybatis+dubbo+zookeeper分布式架构

    框架简介--主要定位于互联网企业架构,已内置企业信息化系统的基础功能和高效的代码生成工具,包括:系统权限组件.数据权限组件.数据字典组件.核心工具 组件.视图操作组件.工作流组件组件.代码生成等.采用 ...

  4. springmvc+mybatis+dubbo+zookeeper+restful

    JEESZ驱动式项目构建 内置高效可靠的代码生成器 支持多种数据模型,根据数据库表生成常规重复性代码,使研发工程师更专注于业务逻辑代码的实现,大幅提升其工作效率,解放其重复性工作 OPEN CI 开源 ...

  5. 构建dubbo分布式平台-maven构建根项目

    导语:在dubbo分布式架构构建之前,请大家务必掌握maven的相关技能,因为架构中大量使用maven技术进行项目构建,有不熟的朋友可以在网上找一些资料学习. 1. 准备技能 开发语言:JAVA/J2 ...

  6. springmvc + mybatis + ehcache + redis 分布式架构

    JEESZ UI 基于Bootstrap4 简洁.直观.强悍最受欢迎的 HTML.CSS 和 JS 框架,用于开发响应式布局.移动设备优先的 WEB 项目. 为所有开发者.所有应用场景而设计. 让前端 ...

  7. springmvc + mybatis + ehcache + redis 分布式 架构

    JEESZ UI 基于Bootstrap4 简洁.直观.强悍最受欢迎的 HTML.CSS 和 JS 框架,用于开发响应式布局.移动设备优先的 WEB 项目. 为所有开发者.所有应用场景而设计. 让前端 ...

  8. mybatis+dubbo+ springmvc+zookeeper分布式架构

    分布式 分布式服务:Dubbo+Zookeeper+Proxy+Restful 分布式消息中间件:KafKa+Flume+Zookeeper 分布式缓存:Redis 分布式文件:FastDFS 负载均 ...

  9. 构建springmvc+mybatis+dubbo分布式平台-dubbo简介

    2019独角兽企业重金招聘Python工程师标准>>> 上一篇我们介绍<构建dubbo分布式平台-maven构建ant-utils工具包的构建>,从今天开始,我们进入分布 ...

最新文章

  1. 为.net中的ListBox控件添加双击事件
  2. 搭建Python+Django开发环境
  3. 基于android模拟led发光,LED通知灯模拟app
  4. pytorch Dataset, DataLoader产生自定义的训练数据
  5. Java学习笔记--继承和多态(下)
  6. grid++中打印表格时怎么让每页有打印表头_1分钟!学会快速打印标题行,轻松搞定不加班...
  7. Ubuntu系统安装
  8. bzoj2423[HAOI2010]最长公共子序列
  9. Linux系统管理(5)——使用yum快速搭建LAMP环境【方便快捷版】
  10. Java 中时间处理SimpleDateFormat 中HH和hh的区别
  11. matlab 双胶合透镜 初始,zemax笔记6——例:双胶合透镜的设计
  12. 各代DDR内存的速度表
  13. C++访问控制 public、privates和protected说明符
  14. [Unity]摘录笔记UnityShader(解读shader代码构成)
  15. StereoNet: Guided Hierarchical Refinement for Real-Time Edge-Aware Depth Prediction(ECCV 2018)
  16. 项目进度管理__计划评审技术之标准正态分布表
  17. 我的科幻杂谈1:不读史,无以言
  18. 免费的安装算量软件有哪些?鹏业安装算量与品茗安装算量对比
  19. 《Python 深度学习》刷书笔记 Chapter 3 预测房价:回归问题
  20. 针对网页开发者的滚动锚定功能

热门文章

  1. python使用ctype中”OSError: [WinError 193] %1 不是有效的 Win32 应用程序“的解决办法
  2. zip压缩报错解决:zip warning: name not matched: xxx/xxx/xxx
  3. ip转数字 java_Java IP地址转换和数字相互转换算法
  4. 显示域用户登录的ip或计算机名,如何在使用PowerShell脚本或者VBS脚本,查看域内正在登录的域用户名、主机名和主机IP地址...
  5. AspectJ和Spring AOP(java动态代理和CGLIB)简单介绍
  6. 自学必看篇:从零基础到精通的Python学习路线(附加教程)
  7. 推荐几个9月爆火的 GitHub 电商项目 赶紧收藏
  8. Java自学路线总结,已Get腾讯Offer
  9. aix oracle 10.2.0.1 升级 10.2.0.4,安装oracle 10.2.0.4 on aix 6.1的不同之处
  10. chown -r oracle:oinstall /oracle,ORA-17503: 因为CHOWN -R ORACLE:OINSTALL 导致的