cd new_proto bazel build :protobuf_java :protobuf_java_util cp bazel-bin/libprotobuf_java.jar . cp bazel-bin/libprotobuf_java_util.jar . bazel clean --expunge rm -rf .git .gitignore .gitmodules
BUILDfile to not build java from source, but to use the jars instead. To do that, in the BUILD file delete the rules listed under
Java support. Then, from the
third_party/protobuf/<old_proto>/BUILD filecopy the rules under “Modifications made by bazel” to the new BUILD file. The java rules in there should have the same names as the ones you just deleted under “Java support”. You might need to update the names of the jars in the rules sources to the ones you just build.
third_party/protobuf/<old_proto>/com_google_protobuf_java.BUILDto the new directory.
licensesdeclaration and the
third_party/protobuf/<old_proto>/util/python/BUILDto the corresponding file in the new directory.
new_proto/BUILDfile copy it from
new\_protodirectory according to the protobuf version number.
PROTOBUF\_VERSIONto the name of the directory you just created.
WORKSPACEfile update relative paths of protobuf to point to the new version.
The current version of protobuf is 3.4.0.