2016-09-20 61 views
0

我没有编码几年,现在试图回到游戏中。我正在尝试设置一个非常简单的Scala项目HelloWorld,并在尝试从sbt控制台编译时收到以下错误消息。我正在添加sbteclipse插件来生成eclipse项目设置。无法建立一个简单的Scala项目

[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塞拉利昂与斯卡拉版本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!") 
    } 
} 
+0

WFM。 eclipse命令运行。这是好消息还是坏消息?当sbt最终尝试编译它时,你会在代码中发现两个错误。 –

+0

它需要解析器吗?我会建议安装activator和运行'activator new':http://www.lightbend.com/community/core-tools/activator-and-sbt – pedrorijo91

+0

是的,我通过删除 addSbtPlugin(“com。 typesafe.sbteclipse“%”sbteclipse-plugin“%”4.0.0“) from project_folder/project/plugins.sbt 并放入〜/ .sbt/0.13/plugins/plugins.sbt文件。 – Michael

回答

0

这个问题与sbt版本0.13.12有关,它是在Scala 2.11.8安装的时候用Scala 2.10.x编译的。

我把它去除

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

project_folder/project/plugins.sbt 

工作,并投入

~/.sbt/0.13/plugins/plugins.sbt file.