我有一个多项目构建,我正在尝试将带有sbt-web生成的资产的jar添加到启动脚本的类路径中
我感兴趣的项目叫做网站.
输入show website / web-assets:sbt中的packageBin创建并显示带有资产的jar.我试过放入(网站中的managedClasspath)= website / web-assets:packageBin,但是没有编译:
path/to/build.sbt:58: error: value / is not a member of sbt.Project managedClasspath in website += website/web-assets:packageBin
如何在运行stage任务时创建带有资源的jar,并将其放在启动脚本的类路径中
您正在使用build.sbt命令混合sbt-console命令.
sbt-web docs 给出了一个明确的示例,说明如何为单个项目执行此操作:
(managedClasspath in Runtime) += (packageBin in Assets).value
所以现在我们为多模块构建做同样的事情.假设你有一个看起来像这样的build.sbt
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)
我没有直接测试这个,因为我不知道你的确切配置.然而,这应该给你正确的方向.
翻译自:https://stackoverflow.com/questions/30344861/add-sbt-web-resources-jar-to-classpath-of-sbt-native-packager