Build.scala: 1: not found: sbt object
I am using sbt version 1.0
$ sbt version
[info] Loading project definition from /Users/harit/code/learningScala/project
[info] Set current project to learningScala (in build file:/Users/harit/code/learningScala/)
[info] 1.0
I am using IntelliJ IDEA v14.1.3
for my project and the structure looks like
As you can see, the project was unable to resolve Build
. When I try to run the command line sbt
I see
$ sbt
[info] Loading project definition from /Users/harit/code/learningScala/project
[info] Set current project to learningScala (in build file:/Users/harit/code/learningScala/)
> compile
[info] Updating {file:/Users/harit/code/learningScala/}learningscala...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/harit/code/learningScala/target/scala-2.11/classes...
[error] /Users/harit/code/learningScala/Build.scala:1: not found: object sbt
[error] import sbt.Build
[error] ^
[error] /Users/harit/code/learningScala/Build.scala:3: not found: type Build
[error] object MyBuild extends Build {
[error] ^
[error] two errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 2 s, completed May 28, 2015 8:10:37 PM
>
I'm very new to Scala
, sbt
so don't know what's going on with it.
source to share
MyBuild.scala
was in root
. It should be inside the folder project
. I made this change and now it works. Thanks tpolecat
on IRC who helped me with this
> compile
[success] Total time: 0 s, completed May 28, 2015 8:20:57 PM
> compile
[info] Updating {file:/Users/harit/code/learningScala/}learningscala...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[success] Total time: 0 s, completed May 28, 2015 8:21:22 PM
>
source to share
I have a multi-project sbt build and two of the projects have declared two identical val values ββin the build.sbt files. I moved the duplicated val (s) in Build.scala to the root project as def and the error stopped. Found the answer here: https://github.com/sbt/sbt/issues/1465
example: val samza_gid = "org.apache.samza" in build.sbt file becomes def samza_gid = "org.apache.samza" in Build.scala file.
source to share