Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add sbt-web resources jar to classpath of sbt-native-packager

I have a multi-project build and I'm trying to add the jar with assets generated by sbt-web to the classpath of the launch script

The project I'm interested in is called website.

typing show website/web-assets:packageBin in sbt creates and shows the jar with the assets. I tried putting in (managedClasspath in website) += website/web-assets:packageBin, but that doesn't compile:

path/to/build.sbt:58: error: value / is not a member of sbt.Project

managedClasspath in website += website/web-assets:packageBin

How can I create the jar with assets when I run the stage task, and place it on the classpath of the launch script

like image 912
Martijn Avatar asked May 20 '15 08:05

Martijn


Video Answer


1 Answers

You are mixing sbt-console commands with build.sbt commands.

The sbt-web docs give a clear example how you do it for a single project:

(managedClasspath in Runtime) += (packageBin in Assets).value

So now we do the same thing for a multi-module build. Assuming you have a build.sbt that looks like this

val root = (project in ".")
      .aggregate(common, website)

val common = (project in "commons")
      .settings(
         libraryDependencies ++= Seq(...),
         ...
      )

val website = (project in "commons")
      .enablePlugins(JavaServerAppPackaging, SbtWeb)
      .settings(
         // ------ You configure it like a single module project 
         (managedClasspath in Runtime) += (packageBin in Assets).value
         // ----------------------------------------------------
      )
      .dependsOn(common)

I have not directly tested this as I don't know your exact configuration. However this should give you the right direction.

like image 157
Muki Avatar answered Oct 19 '22 18:10

Muki