Springmvc+mybatis+dubbo distributed platform-maven building the root project

Source: Internet
Author: User

In an article on "Building Dubbo distributed platform-maven code structure," Starting today, we will make a detailed record of each building code, can help you how to quickly build Dubbo distributed Enterprise architecture.

Lead: Before the Dubbo distributed architecture, please be sure to master Maven's relevant skills, because the architecture of the extensive use of MAVEN technology for project building, some friends can find some information online learning.

    1. Preparation skills
      Development language: JAVA/J2EE
      Project Building Management: Maven
      Continuous Integration scenario: Jenkins
      SOA Services: Dubbo, Zookeeper, Restful
      SSO Single Sign-on: Redis, JWT, Restful
      Distributed cache: Redis
      Distributed message Middleware: Zookeeper+kafka
      Distributed files: Fastdfs
      Database connection pool: Alibaba Druid
      Core framework: Spring Framework, Spring MVC, Apache Shiro, MyBatis
      Front-End frame: Bootstrap + HTML5 + CSS3

    2. Create a MAVEN infrastructure project, where you only need to configure the Pom.xml file and the packaged files, as follows:

<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> <!-- Framework Universal Package version Settings-<spring.version>4.2.2.RELEASE</spring.version> <validator.version>5.1.1.final& Lt;/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> <!--Universal Toolkit version set-<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> <!--basic Environment settings-<jdk.version>1.6</jdk.version> <tomcat.veRsion>2.2</tomcat.version> <project.build.sourceencoding>utf-8</project.build.sourceencoding > <downloadSources>true</downloadSources> <!--the JDBC driver version is set--<mysql.driver.version>5.        1.30</mysql.driver.version></properties><dependencies> <!--unit Test--<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</v Ersion> <scope>test</scope> </dependency> <!--Tomcat If there is no need to Servlet-api.jar, Jsp-ap I.jar Package-<dependency> <groupId>javax.servlet</groupId> <artifactid>servle t-api</artifactid> <version>2.5</version> <scope>provided</scope> </depe ndency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactid>jsp-api& Lt;/artifactid> <verSion>2.1</version> <scope>provided</scope> </dependency></dependencies><depe Ndencymanagement> <dependencies> <!--ant Tools Jar--<dependency> <grou Pid>com.sml.sz</groupid> <artifactId>ant-utils</artifactId> &LT;VERSION&GT;${PR            Oject.version}</version> </dependency> <!--ant public configuration Jar--<dependency> <groupId>com.sml.sz</groupId> <artifactId>ant-config</artifactId> &lt ;version>${project.version}</version> </dependency> <!--ant core Framework Jar--&LT;DEP Endency> <groupId>com.sml.sz</groupId> <artifactid>ant-framework</artifactid > <version>${project.version}</version> </dependency> <!--ant Code Auto-Generate Business ja R--<depeNdency> <groupId>com.sml.sz</groupId> &LT;ARTIFACTID&GT;ANT-CORE-GEN&LT;/ARTIFACTID&G            T <version>${project.version}</version> </dependency> <!--ant member business Jar--< Dependency> <groupId>com.sml.sz</groupId> <artifactid>ant-core-member</artif Actid> <version>${project.version}</version> </dependency> <!--ant RESTF UL Service System--<dependency> <groupId>com.sml.sz</groupId> <artifactId>         Ant-web-service</artifactid> <version>${project.version}</version> </dependency>            <!--ant Admin Background Management--<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}</ve            rsion> </dependency> <dependency> <groupId>com.sml.sz</groupId>        <artifactId>ant-member-service</artifactId> <version>${project.version}</version> </dependency> <!--Dubbo End-to-</dependencies></dependencymanagement><build&    Gt <pluginManagement> <plugins> <!--maven--<plugin> & Lt;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> <!--remove temporary files-- <excludes> <exclude>**/*.keep</exclude> <exclude>** /*.keep.*</exclude> <exclude>*.bak</exclude> &LT;EXCLUDE&G T;*.contrib</exclude> </excludes> <showdeprecation>true</showde Precation> <compilerargument>-xlint:unchecked,deprecation,fallthrough,finally</compilerargu Ment> <fork>true</fork> <encoding>${project.build.sourceencodin     G}</encoding>           </configuration> </plugin> <plugin> <groupid>org.a Pache.maven.plugins</groupid> <artifactId>maven-jar-plugin</artifactId> &L                        T;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</grou Pid> <artifactId>maven-release-plugin</artifactId> <version>2.1</ver sion> </plugin> <plugin> <groupid>org.apache.maven.plugins</g Roupid> <artifactId>maven-resources-plugin</artifactId> <version>2.4.3& Lt;/version> <configuration> <!--remove temporary files--&LT;EXCLU Des> <exclude>**/*.keep</exclude> <exclude>**/*.keep.*& Lt;/exclude> <exclude>*.bak</exclude> <exclude>*.contri            b</exclude> </excludes> </configuration> </plugin> <plugin>               <groupId>org.apache.maven.plugins</groupId> <artifactid>maven-site-plugin&                    Lt;/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> <artifacti D>maven-source-plugin</artifactid> <version>2.1.2</version> <executi                        Ons> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> <goal>test-jar           </goal>             </goals> </execution> </executions> <co Nfiguration> <excludeResources>false</excludeResources> <attach&gt                ;true</attach> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> &LT;ARTIFACTID&GT;MAVEN-WAR-PLUGIN&LT;/ARTIFAC                tid> <version>2.4</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactid>maven-ear-plugin</artifact id> <version>2.9</version> <configuration> <versi                on>5</version> </configuration> </plugin> <plugin> <groupid>oRg.apache.maven.plugins</groupid> <artifactId>maven-surefire-plugin</artifactId> <version>2.6</version> <configuration> <testfailureignore&gt                 ;true</testfailureignore> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactid>maven-surefire-re                    Port-plugin</artifactid> <version>2.6</version> <configuration>            <parallel>both</parallel> </configuration> </plugin> <plugin> <groupId>com.google.code.maven-replacer-plugin</groupId> & Lt;artifactid>replacer</artifactid> <version>1.5.1</version> <execut                Ions>    <execution> <phase>prepare-package</phase> &LT;GOALS&G                            T                <goal>replace</goal> </goals> </execution> </executions> </plugin> <!--read the properties files of the system configuration, avoid writing to the profile, and pay attention to modifying the path when using the respective modules--&gt            ; <plugin> <groupId>org.kuali.maven.plugins</groupId> <artifactid>prop Erties-maven-plugin</artifactid> <version>2.0.1</version> <configuratio N> <locations> <location>${basedir}/. /project_${profile}.properties</location> </locations> </configuration&gt                ; <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&gt            ;            <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> &LT;PR ofile> <id>performance</id> <activation> <property> &lt        ;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&                 lt;/value> </property> </activation> <properties> <project> Production </project> </properties> </profile></profiles>< modules> <!--ant Tools Jar--<module>ant-utils</module> <!--ant public configuration Jar--<mod ule>ant-config</module> <!--ant core Framework Jar--<module>ant-framework</module> <!--an T code Auto generate business Jar--<module>ant-core-gen</module> <!--ANT member business Jar--<module>ant-core- member</module> <!--ant Admin Background Management--<module>ant-web-admin</module> <!--ant RESTF UL Service Management System-<module>ant-web-service</module> <!--ANT Member Dubbo service interface and <module>an T-member-facade</moduLe> <!--Ant Member Dubbo service provider--&LT;MODULE&GT;ANT-MEMBER-SERVICE&LT;/MODULE&GT;&LT;/MODULES&GT;&LT;DESCR The super project of the Iption>ant platform defines the basic information for integrating ant programs, as well as dependencies and plugin information, and MAVEN's custom information </description>

</project></span>

    1. Create a packaged script: test, build, etc.
      Build_sit-no-test.bat
      Java Code Collection Code
      <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
Java Code Collection Code
<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
Java Code Collection Code
<span style= "FONT-SIZE:16PX;" >set maven_opts=-xms128-xmx256m
MVN Clean Package--define maven.test.skip=true--define environment.type=pro</span>

    1. To create a packaged properties file:
      Project_sit.properties
      Explanation: The inside can configure the packaging information, such as: IP, domain name, package name, etc.

    2. The code structure is as follows:

Welcome to join me in learning "build Dubbo Distributed platform", I hope you continue to pay attention to the following articles!

Springmvc+mybatis+dubbo distributed platform-maven building the root project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.