SBT报告com.typesafe.sbt#sbt-start-script; 0.10.0的未解析依赖项?

时间:2014-02-15 00:15:53

标签: sbt

我使用SBT 0.13.0

更新结果表明我在项目中使用了SBT 0.12.2 (我使用sbt sbt-version检查并使用{{1}之前)。

使用以下sbt --version SBT似乎无法获取build.sbt插件/依赖项:

sbt-start-script

当我运行version := "0.1" resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/" scalaVersion := "2.10.2" libraryDependencies ++= Seq( "play" % "play_2.10" % "2.1.0", "org.mongodb" %% "casbah" % "2.6.3", "com.github.nscala-time" %% "nscala-time" % "0.8.0", "org.twitter4j" % "twitter4j-stream" % "3.0.5" ) resolvers += Classpaths.typesafeResolver addSbtPlugin("com.typesafe.sbt" % "sbt-start-script" % "0.10.0") 时,我收到以下错误:

sbt clean compile stage

2 个答案:

答案 0 :(得分:1)

你应该移动

addSbtPlugin("com.typesafe.sbt" % "sbt-start-script" % "0.10.0")

进入自己的project/plugins.sbt文件(如插件文档的Details中所述)。这样插件就会被添加到项目安装的插件中​​(通过addSbtPlugin方法调用)。

在同一文档中,有Consider sbt-native-packager instead部分说:

  

更通用的native-packager插件可能会在将来取代此插件:https://github.com/sbt/sbt-native-packager

build.sbt 应如下所示(它仅对插件成功运行有效 - 我检查其他设置,如libraryDependencies):

import com.typesafe.sbt.SbtStartScript

version := "0.1"

resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"

scalaVersion := "2.10.2"

libraryDependencies ++= Seq(
  "play" % "play_2.10" % "2.1.0",
  "org.mongodb" %% "casbah" % "2.6.3",
  "com.github.nscala-time" %% "nscala-time" % "0.8.0",
  "org.twitter4j" % "twitter4j-stream" % "3.0.5"
)

seq(SbtStartScript.startScriptForClassesSettings: _*)

build.sbtproject/plugins.sbt到位的情况下,当您运行sbt shell时,您应该能够为项目生成启动脚本。

jacek:~/sandbox/so/sbt-start-script
$ sbt
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/sandbox/so/sbt-start-script/project
[info] Updating {file:/Users/jacek/sandbox/so/sbt-start-script/project/}sbt-start-script-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] downloading http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.sbt/sbt-start-script/scala_2.10/sbt_0.13/0.10.0/jars/sbt-start-script.jar ...
[info]  [SUCCESSFUL ] com.typesafe.sbt#sbt-start-script;0.10.0!sbt-start-script.jar (2725ms)
[info] Done updating.
[info] Set current project to sbt-start-script (in build file:/Users/jacek/sandbox/so/sbt-start-script/)
[sbt-start-script]> start-script
[info] Updating {file:/Users/jacek/sandbox/so/sbt-start-script/}sbt-start-script...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] downloading http://repo1.maven.org/maven2/com/github/nscala-time/nscala-time_2.10/0.8.0/nscala-time_2.10-0.8.0.jar ...
[info]  [SUCCESSFUL ] com.github.nscala-time#nscala-time_2.10;0.8.0!nscala-time_2.10.jar (712ms)
[info] downloading http://repo1.maven.org/maven2/org/twitter4j/twitter4j-stream/3.0.5/twitter4j-stream-3.0.5.jar ...
[info]  [SUCCESSFUL ] org.twitter4j#twitter4j-stream;3.0.5!twitter4j-stream.jar (441ms)
[info] downloading http://repo1.maven.org/maven2/org/mongodb/casbah-commons_2.10/2.6.3/casbah-commons_2.10-2.6.3.jar ...
[info]  [SUCCESSFUL ] org.mongodb#casbah-commons_2.10;2.6.3!casbah-commons_2.10.jar (539ms)
[info] downloading http://repo1.maven.org/maven2/org/mongodb/casbah-core_2.10/2.6.3/casbah-core_2.10-2.6.3.jar ...
[info]  [SUCCESSFUL ] org.mongodb#casbah-core_2.10;2.6.3!casbah-core_2.10.jar (618ms)
[info] downloading http://repo1.maven.org/maven2/org/mongodb/casbah-query_2.10/2.6.3/casbah-query_2.10-2.6.3.jar ...
[info]  [SUCCESSFUL ] org.mongodb#casbah-query_2.10;2.6.3!casbah-query_2.10.jar (553ms)
[info] downloading http://repo1.maven.org/maven2/org/mongodb/casbah-gridfs_2.10/2.6.3/casbah-gridfs_2.10-2.6.3.jar ...
[info]  [SUCCESSFUL ] org.mongodb#casbah-gridfs_2.10;2.6.3!casbah-gridfs_2.10.jar (462ms)
[info] downloading http://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/2.11.3/mongo-java-driver-2.11.3.jar ...
[info]  [SUCCESSFUL ] org.mongodb#mongo-java-driver;2.11.3!mongo-java-driver.jar (605ms)
[info] downloading http://repo1.maven.org/maven2/org/twitter4j/twitter4j-core/3.0.5/twitter4j-core-3.0.5.jar ...
[info]  [SUCCESSFUL ] org.twitter4j#twitter4j-core;3.0.5!twitter4j-core.jar (523ms)
[info] Done updating.
[info] Wrote start script for mainClass := None to /Users/jacek/sandbox/so/sbt-start-script/target/start
[success] Total time: 21 s, completed Feb 15, 2014 9:43:42 PM

答案 1 :(得分:0)

Play 2.1.0。

project/build.properties中使用:

sbt.version=0.12.2

project/plugins.sbt中使用:

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

addSbtPlugin("play" % "sbt-plugin" % "2.1.0")

project/Build.scala中使用:

import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {
    val appName         = "your_app_name"
    val appVersion      = "1.0"

    val appDependencies = Seq(
        // project dependencies
    )

    val main = play.Project(appName, appVersion, appDependencies).settings(
        // project settings
    )
}

清除您在系统驱动器上可以找到的.ivy2缓存的内容仍然是一个好主意。然后做:

play clean-all
play compile
play ~run