博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
dubbo源码编译
阅读量:5911 次
发布时间:2019-06-19

本文共 4612 字,大约阅读时间需要 15 分钟。

hot3.png

本文以dubbo2.4.11源码编译和打包例

dubbo官网:http://dubbo.io/

源码:https://github.com/alibaba/dubbo

用户指南:http://dubbo.io/User+Guide-zh.htm

开发指南:

 

按官方说明2.4.X是GA稳定版本,去https://github.com/alibaba/dubbo/releases下载最新的2.4.11

解压到D:\project\dubbo\dubbo-dubbo-2.4.11

在编译dubbo前,先执行下面操作

1、opensesame依赖问题,可能会报Non-resolvable parent POM: Could not transfer artifact com.alibaba:opensesame:pom:2.0 from/to opensesame.releases (http://code.alibabatech.com/mvn/releases)

的错误。

打开https://github.com/alibaba/opensesame,下载opensesame(主要是pom.xml文件),解压在D:\project\dubbo\opensesame-master目录

在D:\project\dubbo\opensesame-master目录下,cmd命令行执行

mvn clean install -Dmaven.test.skip

编译完成后,修改D:\project\dubbo\opensesame-master\pom.xml,把版本2.0修改为1.0,

com.alibaba
    
opensesame
    
1.0
     
pom

相同目录再编译一次opensesame

mvn clean install -Dmaven.test.skip

 

2、fastjson依赖包,可能报[ERROR] Failed to execute goal on project dubbo-common: Could not resolve dependencies for project com.alibaba:dubbo-common:jar:2.5.4-SNAPSHOT: Could not find artifact com.alibaba:fastjson:jar:1.1.8 in ibiblio.org (http://mirrors.ibiblio.org/pub/mirrors/maven2) -> [Help 1]错误

修改D:\project\dubbo\dubbo-dubbo-2.4.11\pom.xml,找到 <fastjson_version>1.1.8</fastjson_version>,将1.1.8修改为1.1.39,参考https://github.com/alibaba/dubbo/issues/22

 

3、注释D:\project\dubbo\dubbo-dubbo-2.4.11\pom.xml下边的内容

        
opensesame.releases
http://code.alibabatech.com/mvn/releases
true
false

 

4、hessian-lite依赖包,Unable to find resource 'com.alibaba:hessian-lite:jar:3.2.1-fixed-2' in repository central.repo (http://repo1.maven.org/maven2)

从github的dubbo主库中下载hessian-lite,当前最新的dubbo源码中已带有hessian-lite源码,可以直接取出来加到dubbo 2.4.11中编译(https://github.com/alibaba/dubbo,https://github.com/alibaba/dubbo/tree/master/hessian-lite)

把hessian-lite拷贝到D:\project\dubbo\dubbo-dubbo-2.4.11,

修改D:\project\dubbo\dubbo-dubbo-2.4.11\pom.xml,增加<module>hessian-lite</module>编译

    
    
hessian-lite
dubbo-common
dubbo-container
dubbo-remoting
dubbo-rpc
dubbo-filter
dubbo-cluster
dubbo-registry
dubbo-monitor
dubbo-config
dubbo

修改D:\project\dubbo\dubbo-2.4.11\hessian-lite\pom.xml

        
com.alibaba
        
dubbo-parent
        
2.4.11
    

 

5、增加编译dubbo管理控制台,这一步不是必须的,主要是官方的dubbo管理控制台下载不了,直接自己编译一个,默认下不编译打包dubbo-admin,需要自己增加。

修改D:\project\dubbo\dubbo-2.4.11\dubbo-admin\pom.xml文件,把版本号改为2.4.11

com.alibaba
dubbo-parent
2.4.11

修改D:\project\dubbo\dubbo-dubbo-2.4.11\pom.xml,增加<module>dubbo-admin</module>编译

    
hessian-lite
dubbo-common
dubbo-container
dubbo-remoting
dubbo-rpc
dubbo-filter
dubbo-cluster
dubbo-registry
dubbo-monitor
dubbo-config
dubbo
dubbo-admin

 

6、正式编译dubbo

1)cmd命令行,在D:\project\dubbo\dubbo-dubbo-2.4.11目录下执行命令:

先设置maven内存,否则编译时会报内存不足错误

set MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=512mmvn clean install -Dmaven.test.skip

 

7、添加eclipse支持

在D:\project\dubbo\dubbo-dubbo-2.4.11目录下执行命令:

mvn eclipse:eclipse

可以直接在eclipse运行下边几个程序

dubbo-demo-provider/src/test/java/com.alibaba.dubbo.demo.provider.DemoProvider

dubbo-demo-consumer/src/test/java/com.alibaba.dubbo.demo.consumer.DemoConsumer

dubbo-monitor-simple/src/test/java/com.alibaba.dubbo.monitor.simple.SimpleMonitor

dubbo-registry-simple/src/test/java/com.alibaba.dubbo.registry.simple.SimpleRegistry

 

8、dubbo-admin管理控制台安装

第6步执行完成后,D:\project\dubbo\dubbo-2.4.11\dubbo-admin\target目录会生成dubbo-admin-2.4.11.war,

war包解压到webapps/ROOT目录下,修改WEB-INF\dubbo.properties,

dubbo.registry.address=zookeeper://127.0.0.1:2181dubbo.admin.root.password=rootdubbo.admin.guest.password=guest

dubbo.properties配置zookeeper的注册中心地址(zookeeper的安装配置忽略)

注意:确定zookeeper启动后再去启动tomcat。

 

转载于:https://my.oschina.net/maiyatang/blog/692858

你可能感兴趣的文章
mysqld error(一)
查看>>
Javascript延时函数
查看>>
UML类图关系大全
查看>>
Ant编译Hadoop 1.0.3的eclipse-plugin插件包
查看>>
tensorflow开发环境搭建
查看>>
springMVC启动时,加载数据至内存中配置详解;
查看>>
JDBCRealm Http Digest
查看>>
CentOS 7 网络配置
查看>>
matplotlib 交互式导航
查看>>
eclipse的插件未安装成功
查看>>
由装箱引发的——Integer比较的来龙去脉
查看>>
java 深拷贝
查看>>
UnicodeEncodeError: 'ascii' codec can't encode
查看>>
jvm在什么时候进行进行垃圾回收,在什么时候进行扩大内存
查看>>
【转载】强大的命令行工具wmic
查看>>
JavaScript里的数组转化新方法Array.From
查看>>
修改eclipse下maven项目的java文件编译目录路径
查看>>
直接启动tomcat时为tomcat指定JDK 而不是读取环境变量中的配置
查看>>
ubuntu 安装 chef安装
查看>>
需求整理步骤规范
查看>>