寻找一个编译插件:
gradle依赖添加
dependencies {
classpath "gradle.plugin.org.jruyi.gradle:thrift-gradle-plugin:0.4.0"
}
应用插件
apply plugin: 'com.google.protobuf'
再写一个task
compileThrift {
recurse true
thriftExecutable 'thrift-0.10.0.exe'
generator 'html'
generator 'java', 'private-members'
}
thriftExecutable:指定的是thrift.ext地址,我把他放到了项目的根目录,所以地址写的’thrift-0.10.0.exe’
插件的默认配置
.thrift文件放在src/main/thrift
编译输出的文件在buildDir/generated-sources/thrift