Your Location is: Home > Scala

How to exclude classes from compiling when using executing sbt docker:publishLocal?

From: Monaco View: 1047 Felipe 


My build.sbt file has some configuration to use AkkaGrpcPlugin and DockerPlugin because I am publishing the image at docker hub.

lazy val akkaGrpcVersion = "1.0.2"
lazy val protobufVersion = "3.11.4"

enablePlugins(JavaAppPackaging, JavaServerAppPackaging, AkkaGrpcPlugin, DockerPlugin)

akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Java)
libraryDependencies ++= Seq(
dockerUsername := Some("felipeogutierrez")

The sbt compile and sbt run work just fine, but the command sbt docker:publishLocal is not working because it tries to find some classes created by the gRPC in the target directory.

[error] /home/felipe/workspace-idea/explore-akka/target/scala-2.12/
not found: type UnusedPrivateParameter
[error]       UnusedPrivateParameter unused) {
[error]       ^

these classes belong to the classes at package org.github.felipegutierrez.explore.akka.rpc.greeting and I would like to exclude them from the docker image when I am running sbt docker:publishLocal. I tried this solution but it didn't work. Or find some solution to make this work.

Best answer