Не удалось настроить простой проект Scala
Я не кодирую уже несколько лет и сейчас пытаюсь вернуться в игру. Я пытаюсь настроить очень простой проект 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 с версией scala 2.11.8 и sbt 0.13.12, установленной с версии brew.
Структура каталога проекта
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!")
}
}
1 ответ
Проблема связана с версией 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.