use protobuf3 with some lib which depends on protobuf2 in Java

随声附和 提交于 2019-12-04 17:02:09
  1. Create a sub-project, and name it 'hbase-wrapper'
  2. Move the dependencies for hbase to the new project
  3. Shadow protobuf in the new project
  4. Add dependency to the sub-project on the main project

Here's some snip code

// part of build.gradle of the sub-project
...
dependencies {
    compile group: 'org.apache.hbase', name: 'hbase-client', version: '1.2.4'
}

shadowJar {
    relocate('com.google.protobuf', 'hbasesaver.google.protobuf')
}

// part of build.gradle for main project
...
compile project(path: ':hbase-wrapper', configuration: 'shadow')
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!