首页 > 解决方案 > sbt migration from 0.13.0 to 1.3.0

问题描述

I am getting error while migrating sbt from 0.13.0 to 1.3.0. I am currently facing issue in error: not found: value scriptClasspath.

My build.sbt file after the migration.

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
    )

and also I have attached plugin.sbt file below -

// 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")

What wrong am I doing while migration? there is a syntax error I am not able to figure out.

标签: scalasbt

解决方案


This is the first error that looks like a lead:

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

It says that scriptedClasspath is a PathFinder and you're trying to add elements to it as if it was a Seq[String].

Read the docs on how to work with Path Finders and see the Scaladoc for the PathFinder type.

Most probably you will need to adjust it to something like

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

推荐阅读