0

我已经有几年没有编码了,现在正试图重新进入游戏。我正在尝试设置一个非常简单的 scala 项目HelloWorld并在尝试从 sbt 控制台编译时收到以下错误消息。我正在添加sbteclipse插件来生成 eclipse 项目设置。

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.typesafe.sbteclipse#sbteclipse-plugin;4.0.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]      com.typesafe.sbteclipse:sbteclipse-plugin:4.0.0 (scalaVersion=2.11, sbtVersion=0.13)
[warn]
[warn]  Note: Unresolved dependencies path:
[warn]      com.typesafe.sbteclipse:sbteclipse-plugin:4.0.0 (scalaVersion=2.11, sbtVersion=0.13) (/Users/michael/Development/Scala-Testings/HelloWorld/project/plugins.sbt#L3-4)
[warn]        +- default:helloworld-build:0.1-SNAPSHOT (scalaVersion=2.11, sbtVersion=0.13)
sbt.ResolveException: unresolved dependency: com.typesafe.sbteclipse#sbteclipse-plugin;4.0.0: not found

我在 macOS Sierra 上,从 brew 安装了scala 版本 2.11.8sbt 0.13.12

项目目录结构

src
+- main
   +- scala
      +- HelloWorld.scala
project
+- plugins.sbt
build.sbt

build.sbt 的内容

name := "HelloWorld"

version := "1.0"

scalaVersion := "2.11.8"

plugins.sbt 的内容

logLevel := Level.Warn

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")

HelloWorld.scala 的内容

object HelloWorld extends App {
    def main (args Array[String]) : Unit = {
        println ("HelloWorld!")
    }
}
4

1 回答 1

0

问题与 sbt 版本 0.13.12 有关,它是使用 Scala 版本 2.10.x 编译的,而我安装了 Scala 2.11.8。

我通过删除它来工作

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")

project_folder/project/plugins.sbt

并投入

~/.sbt/0.13/plugins/plugins.sbt file.
于 2016-09-21T09:34:16.693 回答