I'm completely newly at Scala.
I installed java, sbt and scala on Ubuntu 12.04:
nazar_art@nazar-desctop:~$ sbt sbt-version
[warn] Alternative project directory .sbt (/home/nazar_art/.sbt) has been deprecated since sbt 0.12.0.
[warn] Please use the standard location: /home/nazar_art/project
[info] Loading project definition from /home/nazar_art/.sbt
[info] Set current project to default-5b9232 (in build file:/home/nazar_art/)
[info] 0.12.4
nazar_art@nazar-desctop:~$ scala -version
Scala code runner version 2.10.2 -- Copyright 2002-2013, LAMP/EPFL
nazar_art@nazar-desctop:~$ java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)
I installed scala and sbt plugins to Idea.
And when I tried irst example project I see next error:
Cannot resolve symbol List, after next lines:
package example
import common._
object Lists {
def sum(xs: List[Int]): Int = { // <== here underline for List
if (xs.isEmpty) 0
else xs.head + sumList(xs.tail)
}
}
I couldn't figure out what exactly is wrong?
IDEA suggest me importing java.util.List
- but this class doesn't have any isEmpthy()
method.
Any suggestion?
- How to solve this trouble?
Update:
- I reinstalled newly version of IntelliJ IDEA 13 Community
Edition
instead of # 12. Untared in
/usr/local/Idea
. - Removed sbt -
sudo apt-get purge sbt
. And reinstall accord this script. I went to
/MyProjectDirectory/project/
and created 'plugin.sbt' with content:addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.1")
After this I type from my project directory
sbt gen-idea
. It rebuild project for Idea.- And opened this project with idea greeting window (Open Paroject). Of course,
installed
sbt
andscala
plugins.
It should be enough but it shown again:
Cannot resolve symbol List
and suggesting import import scala.collection.immutable.List
. But this isn't helpful. It keep being underlined with red line.