【问题标题】:Trigger SBT assembly from other subproject从其他子项目触发 SBT 程序集
【发布时间】:2016-01-16 20:07:25
【问题描述】:

我有一个根项目,其中包含 3 个子项目和 sbt 配置文件,仅此而已。两个主要子项目称为serverbackend,另一个称为common,是两个主要项目的依赖项。 server 是 PlayFramework 项目。 backed项目配置生成汇编jar到server的资源目录中。

jar 生成正确并且服务器可以看到它,但是我不知道如何在编译backend 时从backend 运行server 任务(即我希望服务器依赖于后端.jar)

/* [...] */

lazy val commonSettings = Seq(
  version := "0.1",
  organization := "org.example",
  scalaVersion := "2.11.7"
)

lazy val server = (project in file("server")).enablePlugins(PlayJava).settings(commonSettings: _*).settings(
  name := """example""",
  libraryDependencies ++= Seq(
    /* [...] */
  ),
  /* [...] */
  unmanagedResourceDirectories in Compile += { baseDirectory.value / "resources" }
).dependsOn(common)


lazy val backend = (project in file("backend")).settings(commonSettings: _*).settings(
  assemblyJarName in assembly := "backend.jar",
  assemblyOutputPath in assembly := server.base / "resources/backend.jar",
  libraryDependencies := Seq(

  )
).dependsOn(common)

lazy val common = (project in file("common")).settings(commonSettings: _*)

onLoad in Global := (Command.process("project server", _: State)) compose (onLoad in Global).value

【问题讨论】:

  • 在服务器中编译

标签: scala playframework sbt sbt-assembly


【解决方案1】:

感谢@pfn 的评论,我得到了它的工作。我需要做的一件事是在服务器子项目设置中插入这一行并将server更改为Compile,现在是这样:

(compile in Compile) <<= (compile in Compile) dependsOn (assembly in backend)

【讨论】:

    猜你喜欢
    • 2012-09-27
    • 1970-01-01
    • 2016-09-25
    • 2021-06-10
    • 2016-05-28
    • 2020-03-29
    • 2014-02-10
    • 2013-03-12
    • 1970-01-01
    相关资源
    最近更新 更多