Using ScalaPB with gogoproto

151 views
Skip to first unread message

girish...@infectiousmedia.com

unread,
Apr 25, 2017, 10:18:32 AM4/25/17
to ScalaPB
I'm very new to both scala and protocol buffers, so apologies if this is a basic question. 

I'm trying to get scalaPB to compile a .proto file which has gogoproto extensions. sbt compile complains on seeing the import with this error:

##################
<--- snip -->
protoc-jar: protoc version: 320, detected platform: linux/amd64
protoc-jar: executing: [/tmp/protocjar4837658652501545766/bin/protoc.exe, --plugin=protoc-gen-scala=/tmp/protocbridge1314948014394846724, --scala_out=grpc:/home/bsgt/000_git_repos/sfk/target/scala-2.11/src_managed/main, -I/home/bsgt/000_git_repos/sfk/src/main/protobuf, -I/home/bsgt/000_git_repos/sfk/target/protobuf_external, /home/bsgt/000_git_repos/sfk/src/main/protobuf/events.proto]
events.proto: Import "github.com/gogo/protobuf/gogoproto/gogo.proto" was not found or had errors.
java.lang.RuntimeException: protoc returned exit code: 1
    at scala.sys.package$.error(package.scala:27)
<--- snip -->
##################

What is the best method to get scalaPB to recognise the dependency? Any help would be much appreciated.

Nadav Samet

unread,
Apr 25, 2017, 10:38:16 AM4/25/17
to girish...@infectiousmedia.com, ScalaPB
Hi Girish,

The protocol buffer compiler is not able to download files from git, so lines like 'import "github.com/gogo/protobuf/gogoproto/gogo.proto"' would only attempt to find files at the local filesystem.

There are two options:
1. Copy the gogo.proto files into your source repository (for example under src/main/protobuf/gogoproto), then import them using:
  import gogoproto/xyz.proto

2. It's unlikely to be the case for you (since it seems that the protos you reference belong to a go project), but if these protos were distributed inside a jar, the last question at https://scalapb.github.io/faq.html would apply.

--
You received this message because you are subscribed to the Google Groups "ScalaPB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalapb+unsubscribe@googlegroups.com.
To post to this group, send email to sca...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalapb/bdbf58fc-5ffa-4ada-9763-c3c1ffe99d6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-Nadav

girish...@infectiousmedia.com

unread,
Apr 25, 2017, 10:48:43 AM4/25/17
to ScalaPB, girish...@infectiousmedia.com
Thanks v much Nadav! I'll try your suggestions. :)


On Tuesday, 25 April 2017 15:38:16 UTC+1, Nadav Samet wrote:
Hi Girish,

The protocol buffer compiler is not able to download files from git, so lines like 'import "github.com/gogo/protobuf/gogoproto/gogo.proto"' would only attempt to find files at the local filesystem.

There are two options:
1. Copy the gogo.proto files into your source repository (for example under src/main/protobuf/gogoproto), then import them using:
  import gogoproto/xyz.proto

2. It's unlikely to be the case for you (since it seems that the protos you reference belong to a go project), but if these protos were distributed inside a jar, the last question at https://scalapb.github.io/faq.html would apply.
On Tue, Apr 25, 2017 at 7:18 AM, <girish...@infectiousmedia.com> wrote:
I'm very new to both scala and protocol buffers, so apologies if this is a basic question. 

I'm trying to get scalaPB to compile a .proto file which has gogoproto extensions. sbt compile complains on seeing the import with this error:

##################
<--- snip -->
protoc-jar: protoc version: 320, detected platform: linux/amd64
protoc-jar: executing: [/tmp/protocjar4837658652501545766/bin/protoc.exe, --plugin=protoc-gen-scala=/tmp/protocbridge1314948014394846724, --scala_out=grpc:/home/bsgt/000_git_repos/sfk/target/scala-2.11/src_managed/main, -I/home/bsgt/000_git_repos/sfk/src/main/protobuf, -I/home/bsgt/000_git_repos/sfk/target/protobuf_external, /home/bsgt/000_git_repos/sfk/src/main/protobuf/events.proto]
events.proto: Import "github.com/gogo/protobuf/gogoproto/gogo.proto" was not found or had errors.
java.lang.RuntimeException: protoc returned exit code: 1
    at scala.sys.package$.error(package.scala:27)
<--- snip -->
##################

What is the best method to get scalaPB to recognise the dependency? Any help would be much appreciated.

--
You received this message because you are subscribed to the Google Groups "ScalaPB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalapb+u...@googlegroups.com.

To post to this group, send email to sca...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalapb/bdbf58fc-5ffa-4ada-9763-c3c1ffe99d6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-Nadav

Giri

unread,
Apr 25, 2017, 11:05:22 AM4/25/17
to ScalaPB, girish...@infectiousmedia.com
First option worked a treat! Nice one!
Reply all
Reply to author
Forward
0 new messages