为什么多项目build.sbt失败了?

时间:2016-02-18 00:15:26

标签: scala sbt

我有以下build.sbt。我正在使用sbt 0.13.9。

name := "myproject"

organization := "myproject"

version := "0.1"

lazy val myproject = project in file(".") aggregate(common, myservice)

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

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

lazy val commonSettings = Seq(
  scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8"),
  scalaVersion := "2.11.7",
  resolvers ++= Seq("Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/")
)

当我运行sbt compile时,它失败并出现以下错误:

[warn]  module not found: common#common_2.10;0.1-SNAPSHOT
[warn] ==== local: tried
[warn]   /home/priyar/.ivy2/local/common/common_2.10/0.1-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/common/common_2.10/0.1-SNAPSHOT/common_2.10-0.1-SNAPSHOT.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: common#common_2.10;0.1-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

如果我删除第10行(.settings(commonSettings:_ *)),它运行正常。但我需要那条线。

我从https://github.com/theiterators/reactive-microservices/blob/master/build.sbt

复制了这个想法

我做错了什么?

1 个答案:

答案 0 :(得分:0)

在依赖第11行之前放置一个点(。)解决了这个问题。不知道为什么我在scala中想到了。是调用方法的可选项。

lazy val myservice = (project in file("myservice")).dependsOn(common)