'ScalaPb sbt: Import "data/common/num.proto" was not found or had errors
My project structure is:
logs
- data
- pubs
- invent.proto
- common
- num.proto
NOTE - The .proto files are not under src/main/protobuf
. They're under a directory called logs
directly under project
In invent.proto
, I have import "data/common/num.proto";
My build.sbt is:
scalaVersion := "2.12.12"
libraryDependencies += "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
PB.includePaths in Compile := Seq(
baseDirectory.value / "logs"
)
excludeFilter in PB.generate := "test-*.proto"
PB.targets in Compile := Seq(
scalapb.gen() -> baseDirectory.value/"src/main/scala"
)
When I compile, I get the below error:
data/common/num.proto: File not found.
data/pubs/invent.proto: Import "data/common/num.proto" was not found or had errors.
How can I solve this issue? I'm not trying to import external .proto files. These files are present in the repo.
Solution 1:[1]
Remove the PB.includePaths
setting and add this instead:
Compile / PB.protoSources := Seq(baseDirectory.value / "logs")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | thesamet |