mtrupkin / sbt-launch4j

launch4j sbt plugin
BSD 2-Clause "Simplified" License
4 stars 0 forks source link

Multi-module build and main classes #3

Open ekis opened 8 years ago

ekis commented 8 years ago

According to existing sbt-launch4j documentation, there is no way to configure underlying launch4j so it is unclear what defaults are being used and how - except relying on defaults from Launch4jPlugin.scala.

Since documentation doesn't mention it, it is not clear to me how multi-module builds should be set up or is it even possible - currently, it seems to me sbt-launch4j expects each module to have its own main class, since after executing sbt build-launcher I am seeing error No main classes were found on all modules, except the one bootstrap module which legitimately has mainClass defined.

How can I setup a multi-module build with this plugin? How can I configure the underlying launch4j and where do I need to place the XML file in?

mtrupkin commented 8 years ago

I'll look into creating an executable with a multi-module build.

ekis commented 8 years ago

Excellent, thank you.

In the interest of completeness and precision, this is very close to build I have currently defined - it fails for all modules except the bootstrapCli one.

lazy val root: Project = (project in file("."))
  .aggregate(common, commonTest, core, bootstrapCli)

lazy val common: Project = (project in file("common"))
  .settings(
    libraryDependencies := ...
)

lazy val commonTest: Project = (project in file("commonTest"))
  .dependsOn(common % "compile -> test")
  .settings(
    libraryDependencies := ...
  )

lazy val core: Project = (project in file ("core"))
  .dependsOn(common, commonTest % "test -> test")
  .settings(
    libraryDependencies := ...,
    javacOptions in (Compile, compile) ++= Seq("-parameters"),
    javacOptions in doc ++= Seq.empty,
  )

lazy val bootstrapCli: Project = (project in file("bootstrapCli"))
  .dependsOn(core % "compile -> compile;test -> test")
  .settings(
    mainClass in Compile := Some("com._3esi.load.bootstrap.cli.Bootstrap")
  )
ldipotetjob commented 6 years ago

you will have the same problem when from the project root directory type: sbt run

ldipotetjob commented 6 years ago

the right solution should be add at your sbt file this line: onLoad in Global ~= ( andThen ("bootstrapCli" :: ))