question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compiling to Proto3, need Proto2

See original GitHub issue

I have a proto file for proto 2.6.1. It must compile to proto 2.6.

However, when I do a compile, it looks like the generated Java is for proto3 …

I find this in the generated java

com.google.protobuf.GeneratedMessageV3 

I am getting lots of compiler failures, because GeneratedMessageV3 is not found (which makes sense since I am using proto-java 2.6.1.

In my sbt, I have this…

  PB.targets in Compile := Seq(
    PB.gens.java("2.6.1") -> (sourceManaged in Compile).value
  )

In the proto file, I have…

syntax = "proto2";

Is there something I am doing incorrectly?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
pauljamesclearycommented, Aug 15, 2018

Thanks! Looks like this works!

FYI, this is the PR I just posted for our repo - https://github.com/vinyldns/vinyldns/pull/113

0reactions
thesametcommented, Aug 15, 2018

Correct, this plugin depends on https://github.com/os72/protoc-jar which ships with many different versions of protoc. Currently 3.5.1 is the default version. Also, you can set PB.runProtoc if you want sbt-protoc to use a locally installed protoc instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Language Guide | Protocol Buffers - Google Developers
When you run the protocol buffer compiler on a .proto , the compiler generates ... It's possible to import proto3 message types and...
Read more >
Compiling proto2 syntax file with proto3 compiler
I have a proto file written in proto2 syntax. I am compiling this proto file using proto3 compiler. Although it bulids successfully, ...
Read more >
using proto3 for receiving proto2 messages ("group", C#)
I want to code my application to consume their data in C#. So I was trying to use proto3 to compile their .proto...
Read more >
Hi there, I work on the protobuf team at Google. A friendly note ...
Proto2 schemas will support extensions forever (even after Protobuf 3.0), so there's no need to avoid extensions. You are only using proto3 schemas...
Read more >
Protocol Buffer Compiler Installation - gRPC
While not mandatory, gRPC applications often leverage Protocol Buffers for service definitions and data serialization.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found