dubbomaven如何構(gòu)建根項目

這篇文章主要講解了“dubbo maven如何構(gòu)建根項目”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“dubbo maven如何構(gòu)建根項目”吧!

為青山等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及青山網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為成都網(wǎng)站建設(shè)、成都網(wǎng)站制作、青山網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!

1. 準(zhǔn)備技能

開發(fā)語言:JAVA/J2EE

項目構(gòu)建管理:Maven

持續(xù)集成方案:Jenkins

SOA服務(wù): Dubbo、zookeeper、Restful

SSO單點登錄:redis、JWT、Restful

分布式緩存:Redis

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

分布式文件:FastDFS

數(shù)據(jù)庫連接池:Alibaba Druid

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

前端框架:Bootstrap + html5 + CSS3

2. 創(chuàng)建maven基礎(chǔ)項目,其中只需要配置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>
        <!-- 框架通用包版本設(shè)置 -->
        <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>
 
        <!-- 通用工具包版本設(shè)置 -->
        <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>
 
        <!-- 基礎(chǔ)環(huán)境設(shè)置 -->
        <jdk.version>1.6</jdk.version>
        <tomcat.version>2.2</tomcat.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <downloadSources>true</downloadSources>
 
        <!-- jdbc驅(qū)動版本設(shè)置 -->
        <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 代碼自動生成業(yè)務(wù)jar -->
            <dependency>
                <groupId>com.sml.sz</groupId>
                <artifactId>ant-core-gen</artifactId>
                <version>${project.version}</version>
            </dependency>
            <!-- ant 會員業(yè)務(wù)jar -->
            <dependency>
                <groupId>com.sml.sz</groupId>
                <artifactId>ant-core-member</artifactId>
                <version>${project.version}</version>
            </dependency>
             
            <!-- ant RestFul服務(wù)系統(tǒng) -->
            <dependency>
                <groupId>com.sml.sz</groupId>
                <artifactId>ant-web-service</artifactId>
                <version>${project.version}</version>
            </dependency>
            <!-- ant admin后臺管理系統(tǒng) -->
            <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>
 
                <!-- 讀取系統(tǒng)配置的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 代碼自動生成業(yè)務(wù)jar -->
        <module>ant-core-gen</module>
 
        <!-- ant 會員業(yè)務(wù)jar -->
        <module>ant-core-member</module>
 
        <!-- ant admin后臺管理系統(tǒng) -->
        <module>ant-web-admin</module>
 
        <!-- ant Restful服務(wù)管理系統(tǒng) -->
        <module>ant-web-service</module>
 
        <!-- ant member Dubbo服務(wù)接口 -->
        <module>ant-member-facade</module>
 
        <!-- ant member Dubbo服務(wù)提供者 -->
        <module>ant-member-service</module>
    </modules>
    <description>ant平臺的super工程,定義了整合ant項目群的基本信息,以及依賴項和插件信息、maven的自定義信息</description>
</project></span>

2. 創(chuàng)建打包腳本:測試、生成等

build_SIT-no

<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. 創(chuàng)建打包的properties文件:

project_sit.properties

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

4. 代碼結(jié)構(gòu)如下:

dubbo maven如何構(gòu)建根項目

感謝各位的閱讀,以上就是“dubbo maven如何構(gòu)建根項目”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對dubbo maven如何構(gòu)建根項目這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!

本文題目:dubbomaven如何構(gòu)建根項目
鏈接分享:http://www.muchs.cn/article48/iidghp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊、網(wǎng)站排名網(wǎng)站策劃、網(wǎng)站改版、定制網(wǎng)站、定制開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

微信小程序開發(fā)