How to import proto file from subproject
See original GitHub issueHi, I have subprojects with SBT.
lazy val protoSetting = Seq(
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value//(scalaSource in Compile).value / "buffer"
)
)
lazy val sharedBase = (project in file("sharedBase")).settings(
scalaVersion := scalaV,
credentials += Credentials(Path.userHome / ".sbt" / "isCredentials"),
resolvers ++= standardResolver,
libraryDependencies ++= standardDeps,
protoSetting
)
lazy val purchaseDepartment = (project in file("purchaseDepartment")).settings(
scalaVersion := scalaV,
credentials += Credentials(Path.userHome / ".sbt" / "isCredentials"),
resolvers ++= standardResolver,
libraryDependencies ++= standardDeps,
protoSetting,
PB.protoSources in Compile += target.value / "protobuf_external" / "de" / "scalamat" / "event" / "common"
).enablePlugins(DockerPlugin).dependsOn(sharedBase)
Now I have a proto file laying inside the sharedBase. How I can add now this proto to my proto in the purchasedepartment?
Thank you
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Import .proto files from another project
In order to compile your proto, you should clone the dependency repos and set as include path in the protoc import, as example:...
Read more >Include a multi-file protobuf package in a .NET Core project
Notice that even though the proto files are in the same folder, the import statement uses the path Protos/bar.proto , and not just...
Read more >Using third-party protos - ScalaPB
The first one makes sbt-protoc unpack the protos from the jar and add them to the import search path so protoc can import...
Read more >Reusing Your Proto Files in Maven Multi-Module Project
The first step in sharing the .proto files is that you need to generate the Java classes from the .proto file. You will...
Read more >ScalaPB/community - Gitter
includePaths in Compile += file("protos/src/main/protobuf"), PB. ... package proto; import "google/protobuf/timestamp.proto"; message CommonProto { }.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, if there’s a package statement in file A, and file B imports file A, and file file (B) has a different package statement (or no package statement) then you need to reference types by the package name.
To make sure protoc is searching for files in sharedBase when it encounters an “import” statement in a proto file, add something like this to purchaseDepartment’s settings: