Error while importing google/protobuf/descriptor.proto

2,474 views
Skip to first unread message

Sridhar

unread,
May 6, 2016, 8:43:40 AM5/6/16
to ScalaPB
Hi,

I am trying to import google/protobuf/descriptor.proto to define a field descriptor and compile my .proto to .scala files. But I get the below error:

Image.proto: Import "google/protobuf/descriptor.proto" was not found or had errors. 

Image.proto:26:12: "google.protobuf.FileDescriptorSet" is not defined.


I understand that the protoc compiler is not able to find the imported files(correct me if I am wrong here). Assuming this as the reason, is there a way to pass library options(libraryDependencies in sbt) to scalapbc?

Sridhar

Nadav Samet

unread,
May 7, 2016, 1:06:10 AM5/7/16
to Sridhar, ScalaPB
Hi Sridhar,

Try adding this to your build.sbt:

libraryDependencies += "com.google.protobuf" % "protobuf-java" % "3.0.0-beta-2" % PB.protobufConfig


--
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/10cfb70c-2242-44c2-b349-94ea23eb62b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-Nadav

Sridhar

unread,
May 7, 2016, 2:49:07 AM5/7/16
to Nadav Samet, ScalaPB
Hi Nadav,

I don't use SBT. I use the scalapb command line tool. Sorry for not being clear.

Sridhar

Nadav Samet

unread,
May 7, 2016, 11:11:55 AM5/7/16
to Sridhar, ScalaPB
Hi Sridhar,

In that case just pass "-I path/to/folder" to the folder where descriptor.proto is.
--
-Nadav

Sridhar

unread,
May 10, 2016, 7:13:48 AM5/10/16
to Nadav Samet, ScalaPB
Hi Nadav,

Sorry for the delayed response. I get the below error when I try to do that

AlignTypes.proto: File does not reside within any path specified using --proto_path

Sridhar

Nadav Samet

unread,
May 10, 2016, 2:05:47 PM5/10/16
to Sridhar, ScalaPB
You may need to pass multiple -I flags, for each source root.
--
-Nadav
Reply all
Reply to author
Forward
0 new messages