I have created a sbt (v.0.13.8) project with some sub-project (I have a good reason for this, see Apache Spark and gRPC).
What I would like to have is a
- root project
- few sub-projects
- have at least one of the sub-projects create a jar file that is included in the root project (I want to include the jar file and not the target, as in the jar file I apply some shading/relocation)
For this purpose, I have created a root-build file (build.sbt) which refers to a sub-project (grpc):
lazy val root = project.
settings(commonSettings: _*).
aggregate(grpc).
dependsOn(grpc % "compile->assembly")
And in grpc/build.sbt I write
assemblyOutputPath in assembly := sbt.file("../lib/grpc-assembly-0.1-SNAPSHOT.jar")
I had hoped that by doing this, I could generate a jar file, put it into the lib folder of the root project and use it from there.
So far, unfortunately, the assembly task is not recognized and I get the following error:
sbt.ResolveException: unresolved dependency:
io.tmp#grpc_2.10;0.1.0: configuration not found in
io.tmp#grpc_2.10;0.1.0: 'assembly'.
It was required from io.tmp#root_2.10;0.1.0 compile
I have added in grpc/project/assembly.sbt the necessary addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.2")
command, and if go into the folder grpc and do sbt assembly
, it works. Similarly, I have the same file also in the top project folder (project/assembly.sbt). Why doesn't it find the assembly task here? Did I misunderstand something? Do you see problems in what I try to do here?