sbt 从 0.13.0 迁移到 1.3.0

sbt migration from 0.13.0 to 1.3.0

我在将 sbt 从 0.13.0 迁移到 1.3.0 时遇到错误。我目前遇到错误问题:未找到:value scriptClasspath.

迁移后我的 build.sbt 文件。

val main = (project in file(".")).
     settings(
        appName         = "polaris",
        appVersion      = "1.strong text8.8",
        //scriptClasspath := Seq("modules/*", "customer-modules/*")
       // scriptClasspath = Seq[File] = file("modules/*") :: ("customer-modules/*") :: Nil
        **scriptClasspath** ~= { cp => cp.+:("modules/*").+:("customer-modules/*") }
    ).dependsOn(
       core, addressbook, pbx, pbxAppSoftphones, pbxAppCallLog, pbxAppQueues, pbxAppPhonebook, pbxAppClick2dial, pbxAppOperator
    ).aggregate(
       core, addressbook, pbx, pbxAppSoftphones, pbxAppCallLog, pbxAppQueues, pbxAppPhonebook, pbxAppClick2dial, pbxAppOperator
    )

我还附上了下面的 plugin.sbt 文件 -

// Comment to get more information during initialization
logLevel := Level.Warn


// The Typesafe repository
//resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"

//resolvers += "Maven Central Server" at "https://repo1.maven.org/maven2"

resolvers += Resolver.url("bintray-sbt-plugins", url("http://dl.bintray.com/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.2")

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.6")

迁移时我做错了什么?有一个语法错误我无法弄清楚。

这是第一个看起来像线索的错误:

error: value +: is not a member of sbt.io.PathFinder scriptedClasspath ~= { cp => "modules/" +: "customer-modules/" +: cp }

它说 scriptedClasspath 是一个 PathFinder,而您正在尝试向它添加元素,就好像它是一个 Seq[String]

阅读有关如何使用 PathFinder 类型的 Path Finders and see the Scaladoc 的文档。

您很可能需要将其调整为

scriptedClasspath ~= { pathFinder => 
  pathFinder +++
  (baseDirectory.value / "modules") +++ 
  (baseDirectory.value / "customer-modules")
}