Lifty with sbt 0.10 - scala

I am try to learn scala with lift. So i started setting up my development environment. After sbt i try install Lifty (i used this article as manual). But i have a problem with my sbt:
> *lifty is org.lifty lifty 1.6.1
[error] Expected ':'
[error] *lifty is org.lifty lifty 1.6.1
[error] ^

Lifty 1.6.x is aimed to be used with SBT 0.7.x. The error shown is due to the fact that Lifty 1.6.x is a SBT processor, while SBT from 0.9.x use plugins instead, so you would need Lifty 1.7.
To get started I would recommend you to use SBT 0.7.7 and Lifty 1.6.1 as there is a lot of information for these and they work beautifully. Please note that Lift has a very active and willing to help community, so you can also ask these questions in the Lift mail list.

Related

How to Compile Apache Spark with Scala 2.11.1 using SBT?

I've been trying to compile Apache spark with scala-2.11.1 (the latest version at the time). However, each time I try it ends up compiling everything to scala-2.10.*. I don't understand why.
The official documentation suggests that we use maven for compilation after switching to 2.11 using script in the dev/ folder.
What if I wanted to use sbt instead?
You need to enable scala-2.11 profile
>sbt -Dscala-2.11=true
sbt> compile

Is the usage of Scalariform as an embedded library considered abandoned?

I had been using Scalariform in a project I upgraded to Scala 2.11. In doing so, I discovered that Scalariform does not appear to have an artifact published for 2.11 in any of the usual places. This makes the usual sbt cross-version dependency unhappy.
As 2.11 has been out for a while already, this has me questioning if the usage of Scalariform as an embedded library should be considered abandoned? Has the community moved on to an alternative I just don't know about?
Scalafmt is an alternative code formatter that does compile to 2.11 and can be used as an embedded library. An up-to-date usage example is here https://olafurpg.github.io/scalafmt/#Standalonelibrary

sbt console doesn't allow input

I've been trying to use sbt for one of my projects, however I've ran into the following problem - when I try to use sbt console to get the scala's REPL, it just doesn't allow any input. Example session:
[lared#lt foo]$ sbt
[info] Set current project to foo (in build file:/tmp/foo/)
> console
[info] Updating {file:/tmp/foo/}foo...
[info] Resolving org.scala-lang#scala-reflect;2.10.3 ...
[info] Done updating.
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.10.3 (OpenJDK 64-Bit Server VM, Java 1.8.0_25).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
I can not type anything. It doesn't seem to take much RAM/CPU time. The problem is reproducible in any directory, regardless of if it does have a proper project structure (for example the SBT Hello World tutorial) or not.
I'm using sbt 0.13.1 and the JDK/Scala versions as seen above on Fedora 21.
The problem was solved by deleting ~/.ivy2/ and (perhaps unrelated) migration to Oracle Java 1.7 SDK.
I could not find a way to get the Fedora 24 installed sbt 0.13.1 console to work either so I downloaded the latest sbt (currently 0.13.12), unzipped into /opt and add the sbt binary to my path before /usr/bin/sbt.
The earlier suggestion to delete ~/.ivy2 did not work for me.

Conflicting cross-version suffixes (sbt, Scala-STM, Play-JSON)

I am using a JSON extension which relies on Mandubian's play-json 2.2-SNAPSHOT. Everything worked fine until now I have a project based on Scala-STM. sbt reports the following problem:
[error] Modules were resolved with conflicting cross-version suffixes
in {file:folder}project:
[error] org.scala-stm:scala-stm _2.10, _2.10.0
java.lang.RuntimeException: Conflicting cross-version suffixes in:
org.scala-stm:scala-stm
Is there any chance to dig deeper into where these two "conflicting" versions come from? I am quite surprised that play-json should be depending on scala-stm?!
Furthermore, is there a way to convince sbt to shut the ... up. Because obviously 2.10 and 2.10.0 are equivalent versions.
EDIT: This seems to be an sbt 0.13 bug (and probably has nothing to do with Play-JSON), because if I revert to 0.12.4, the project successfully updates and builds. I am still interested in a work around for sbt 0.13.
You can get around this by removing scala-stm with exclude
"dependencyGroupId" %% "dependencyArtifactId" % "dependencyVersion" exclude("org.scala-stm", "scala-stm_2.10.0")
Do not forget to do sbt clean.
Updated Play2 2.2 - downgrading to SBT from 0.13.0 -> 0.12.4 didn't work with me, but excluding using exclude("org.scala-stm", "scala-stm_2.10.0") on ALL app-specific dependencies I had worked fine -- anyway -- none of my dependencies shouldn't have anything to do with scala-stm.
If you'd like to see all libraries being pulled in to your SBT project, you can use the SBT dependency graph plugin.
Using this, you can see why scala-stm is being pulled in, and also check for other conflicting scala 2.10 and 2.11 dependencies.

sbt unresolved dependencies sbt_2.9.1;0.7.4 sbt_2.9.1;0.7.7:

I was getting the unresolved dependencies like the question here.
Getting org.scala-tools.sbt sbt_2.9.1 0.7.7 ...
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.scala-tools.sbt#sbt_2.9.1;0.7.7: not found
::::::::::::::::::::::::::::::::::::::::::::::
SBT 0.7.7 uses Scala 2.7.7 for the project configuration. SBT 0.11 uses Scala 2.9.1. You can use SBT 0.7.7 for configurations up to that version, but versions of SBT newer than 0.7.7 use a non-compatible configuration file.
Note that this is not related to the Scala version that will be used to compile the project itself, just the Scala version that is used to compile the configuration file. These are different things: you can use whatever version of Scala you want to compile your project, but you must use the version of Scala mandated by the SBT version to compile the project configuration.
To get an error message like that you must either have changed the Scala version for the project configuration, or used a newer SBT with a project written for an older version of SBT. Find out which it was, and correct the problem as needed.
I have an SBT 0.7.7 for projects that have not yet migrated to the new version, and the latest SBT for everything else. Put a different name on each script, and you are good to go.
While sbt-launch.jar makes an attempt to download and use the version of sbt specified in the project's project/build.properties, they must be compiled with matching versions of Scala. I think sbt 0.7.7 was compiled with Scala 2.7, but the most recent versions of sbt are compiled with Scala 2.9.
Most folks now just use a version of sbt-launch.jar that matches the version specified in project/build.properties. If you're running on Linux, OS X, or pretty anything that can run a Bash script, I highly recommend the launch script from sbt-extras. It will automagically use the version of sbt-launch.jar according to what's specified in project/build.properties, and gives some other handy command line parameters.
If that doesn't work for you, I think your best bet is different launch scripts to launch the different minor versions of sbt. Such as sbt7, sbt10 and sbt11, which launch 0.7.7, 0.10.1 and 0.11.2, respectively.
I have noticed that the issue can be resolved by updating or removing the sbt.version entry from project_root_folder/project/build.properties My current sbt version is 0.11.2 and I have updated it to sbt.version=0.11.2 . Removing the entry also works.