ogen
ogen

Reputation: 792

sbt-native-packager defining multiple mainClasses in different modules

I would like to package multiple docker images, each one having its own mainClass, to ensure the app is running on startup.

lazy val `core` = project.in(file("core"))
  .enablePlugins(JavaServerAppPackaging, DockerPlugin)
  .settings{
    mainClass in Compile := Some("path/to/Core") // Doesn't work
  }

lazy val `benchmark` = project.in(file("benchmark"))
  .enablePlugins(JavaServerAppPackaging, DockerPlugin)
  .settings{
    mainClass in Compile := Some("path/to/Benchmark") // Doesn't work
  }

This does not work as the mainClasses are not found in the stage step.

When I define mainClass as a global parameter it works, but I can't build two auto-running Docker images this way.

Thanks for your help

Upvotes: 0

Views: 249

Answers (1)

mkantepe
mkantepe

Reputation: 55

I am not experienced with sbt-native-packager but mainClass is the classpath not the file path, so it must be defined as:

mainClass in (Compile, packageBin) := Some("com.bar.baz.Foo")

Upvotes: 3

Related Questions