- 从github上克隆到本地
$ git clone https://github.com/grpc/grpc-java.git
2.切换分支
想尝试0.15.0版本的,可以切换到v0.15.x分支上
$ git branch -a ——显示分支列表
* master
remotes/origin/HEAD -> origin/master
remotes/origin/android
remotes/origin/gh-pages
remotes/origin/master
remotes/origin/typo
remotes/origin/v0.12.x
remotes/origin/v0.13.x
remotes/origin/v0.14.x
remotes/origin/v0.15.x
remotes/origin/v0.7.x
remotes/origin/v0.8.x
remotes/origin/v0.9.x
remotes/origin/v1.0.x
$ git checkout v0.15.x ——切换到v0.15.x分支
Branch v0.15.x set up to track remote branch v0.15.x from origin.
Switched to a new branch 'v0.15.x'
注意:0.15.x分支没有对Maven作支持,只支持gradle构建
3.对Master分支进行构建
由于我们不需要构建protoc编译插件(使用Maven中央仓库中的),所以在项目根目录下新建gradle.properties文件:
添加如下的语句,表示跳过protoc插件的编译:
skipCodegen=true
保存之后,就可以执行编译工作:
再然后,执行下边的语句,将编译好的gRPC相关的jar都安装到本地Maven仓库中:
$ ./gradlew install