So, basically everything was fine till my last invocation of sbt compile
... 2 days back.
But now when I invoke sbt compile
, it is expecting every statement to end with ;
.
Example:
Following causes problem,
package me.example.sample
import java.util.UUID
Error,
'{' expected but 'import' found.
[error] import java.util.UUID
^
But this works fine,
package me.example.sample;
import java.util.UUID;
How do I solve this issue ?
I am running Scala 2.11.5
with Oracle java 1.8.0_40
.
So... In case some one else faces the same problem in future.
Basically Scala avoids semicolons
by using line-endings
as statement separators.
So... In scala following two things are equivalent:
println( "Hello" ); prinln( "World" )
And
println( "Hello" )
prinln( "World" )
Now, line endings are differently represented in three most popular operating systems.
Windows - CRLF - `\r\n`
Linux - LF - `\n`
Mac - CR - `\r`
Now, depending on your operating environment, Scala compiler will expect to have corresponding line endings as statement separators
otherwise it will be very very confused.
So... In case you get this sort of problem. Please check your line endings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With