【发布时间】:2016-09-21 17:34:16
【问题描述】:
我已经有几年没有编写代码了,现在正试图重新投入到游戏中。我正在尝试设置一个非常简单的 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.8 和 sbt 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!")
}
}
【问题讨论】:
-
WFM。 eclipse 命令运行。这是好消息还是坏消息?当 sbt 最终尝试编译时,你会在你的代码中发现两个错误。
-
是否需要解析器?我建议安装激活器并运行
activator new:lightbend.com/community/core-tools/activator-and-sbt -
是的,我通过从 project_folder/project/plugins.sbt 中删除 addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0") 并放入 ~ /.sbt/0.13/plugins/plugins.sbt 文件。
标签: eclipse scala sbteclipse