播放2.3子项目dependsOn(Play 2.3 subproject dependsOn)

2019-10-20 08:04发布

这是我如何配置子项目在播放2.3。 然而,它给了我sbt.ResolveException:未解析的依赖性。 什么是错我的设置? 这适用于2.2。

    val model = Project(appName + "-model", file("models")).enablePlugins(play.PlayScala).settings(
      version := appVersion,
      libraryDependencies ++= modelDependencies          
    )

    val main = Project(appName, file(".")).enablePlugins(play.PlayScala).enablePlugins(SbtWeb).settings(
      version := appVersion,
      libraryDependencies ++= appDependencies
    ).dependsOn(model % "test->test;compile->compile")

Answer 1:

尝试这个:

  lazy val model = Project(
    id = s"${appName}-model", 
    base = file("models"))
    .enablePlugins(play.PlayScala)
    .settings(version := appVersion)
    .settings(scalaVersion := "2.11.1" )
    .settings(libraryDependencies ++= modelDependencies)

  lazy val main = Project(
    id = appName,
    base = file("webapp"))
    .enablePlugins(play.PlayScala)
    .enablePlugins(SbtWeb)
    .settings(name := "play-scala")
    .settings(version := appVersion)
    .settings(scalaVersion := "2.11.1" )
    .settings(libraryDependencies ++= appDependencies)
    .dependsOn(model % "test->test;compile->compile")

  override def rootProject = Some(main) 


文章来源: Play 2.3 subproject dependsOn