I have a multi project setup like this:
lazy val kalosrpc = project
.settings(
libraryDependencies ++= Seq(
"io.grpc" % "grpc-netty" % scalapb.compiler.Version.grpcJavaVersion
)
).dependsOn(kalosgen)
lazy val kalosgen = project
.settings(
// settings not important
)
The main class of kalosgen
generates a model via slick-codegen
and places is it in:
kalosgen/target/scala-2.13/src_managed/main
in the package com.kalos.gen
. It also compiles protobufs into scala classes at compile time but that package is in the classpath as expected.
I can then import those files from kalosgen
into kalosrpc
, intelliJ does not complain and has full access to the type information defined in those files. So I run kalosgen/compile
and the packages are generated as I expect however when I follow that up with kalosrpc/compile
I get:
object gen is not a member of package com.kalos
I've tried changing the name of the packages but it doesn't fix anything. Based on the information presented here my project configuration seems correct.
The problem here was that I was generating the sources in scala code via the
slick-codegen
utility:My guess is that you have to generate sources via SBT tasks to have them recognized by SBT as being valid sources (at least for the purposes of inter project dependencies), so I was able to translate the above code to a task that runs at compile time in
build.sbt
:Now the generated
Tables.scala
appears as expected in the class path and my project compiles. If someone with more knowledge of sbt could provide a more comprehensive explanation of why this happened I will gladly accept it as the proper answer.