Lift - Setting it up - scala

Today I started with scala and lift and I am currently reading though the docs. I managed to get it started with the help of the cookbook.
However I want to read though some bigger examples, especially this example because it uses mongodb + authentication https://github.com/eltimn/lift-mongo.g8/tree/master/src/main/g8
I didn't use g8 nor cs because I had some errors with cs and I was to lazy to investigate them.
So I just cloned the repo to my hard drive. I think that is what g8 is doing.
So some files are missing, I added them
sbt
sbt.bat (I am using windows)
sbt-launch.jar
But I get the following errors:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-sbt#sbt-closure;0.1.3: not found
[warn] :: com.github.siasia#xsbt-web-plugin_2.9.1;0.11.2
ound
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
I tried to fix the sbt-closure but I could not find it in with the maven search
http://search.maven.org/#search%7Cga%7C1%7Csbt-closure
the plugins.sbt looks like this
resolvers += Resolver.url("sbt-plugin-releases",
new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(
Resolver.ivyStylePatterns)
addSbtPlugin("org.scala-sbt" % "sbt-closure" % "0.1.3")
addSbtPlugin("me.lessis" % "less-sbt" % "0.1.10")
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.11.1"))
Any idea what went wrong?

SBT plugins need to be re-published for each new version of SBT. My guess is that the template you downloaded was based on an older version of SBT (0.11 maybe?) and that the versions of the plugins you are referencing haven't been published for the latest SBT (0.12). You could try to find an older version of SBT to download, but you're probably better off either getting g8/conscript working, or using one of these templates: https://github.com/lift/lift_24_sbt.

Related

Using berkeley hardfloat

I am using Chisel3 in my project. I tried to import hard float library as folow:
import chisel3._
import hardfloat._
but unfortunately, I am getting:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: edu.berkeley.cs#hardfloat_2.11;1.2: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
I went through couple of repositories that used hardfloat and found out that I was missing this line in my build.sbt:
libraryDependencies ++= Seq("edu.berkeley.cs" %% "hardfloat" % "1.2")
but unfortunately I am still getting the error. I then tried to compile projects that use hardfloat without any modification (for example soundkit) but I still get the same error. I used both terminal and InteliJ to compile my project and got the same result. For some reason, the hardfloat library is not even shows up in the External Libraries in IntelliJ .
I would really appreciate it if someone let me know what might be the issue.
pedrofurla was right. After talking to folks at RISC-V, I got to know that, as you said, the hardfloat is not published to somewhere that sbt can download it. In order to use the library, one has to build and publish it locally:
git clone https://github.com/ucb-bar/berkeley-hardfloat.git hardfloat
cd hardfloat
sbt publish-local
Note: the library works with chisel2

How is SBT determining the scalajs-react version to download

I'm using SBT 0.13.7 to build a Scala 2.10.4 project. I'm using Artifactory basically as a local offline cache (although this problem is present when I try to populate it, online).
I've included the scalajs-react library with
libraryDependencies += "com.github.japgolly.scalajs-react" %%% "core" % "0.11.2"
but I get
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.github.japgolly.scalajs-react#core_sjs0.6_2.10;0.11.2: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
I have Artifactory pointing at
http://central.maven.org/maven2/
among other repos, but it looks like this has 0.6_2.11
http://central.maven.org/maven2/com/github/japgolly/scalajs-react/core_sjs0.6_2.11/
How has SBT determined that it needs 0.6_2.10, and can I influence it in some way?
EXTRA:
Looks like I can point it in the right direction with
libraryDependencies += "com.github.japgolly.scalajs-react" %%% "core" % "0.11.2" from "http://central.maven.org/maven2/com/github/japgolly/scalajs-react/core_sjs0.6_2.11/0.11.2/core_sjs0.6_2.11-0.11.2.jar"
but that seems to completely bypass Artifactory.
You can use scala-js-react 0.5.4 with Scala.js 0.5.X. It's the last version to support 2.10 (see maven central).

SBT adding an extra tag to dependency location

I'm very new to the SBT / Maven build process and have been struggling to add the Java MongoDB Async Driver to my Play framework application. I've looked everywhere for a solution since this seems like a simple issue but haven't been able to find anything since I don't really know what to look for.
In my build.sbt file:
addSbtPlugin("org.mongodb" % "mongodb-driver-async" % "3.2.1")
Compiling the code:
[info] Resolving org.mongodb#mongodb-driver-async;3.2.1 ...
[warn] module not found: org.mongodb#mongodb-driver-async;3.2.1
...
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/org/mongodb/mongodb-driver-async_2.10_0.13/3.2.1/mongodb-driver-async-3.2.1.pom
The correct address is:
https://repo1.maven.org/maven2/org/mongodb/mongodb-driver-async/3.2.1/mongodb-driver-async-3.2.1.pom
Is there any way to 'remove' the extra _2.10_0.13 so that the project is able to find the pom file? Or is there an easier solution I have overlooked?
Thank you for your help, I really appreciate it!
As its just a normal dependency rather than an sbt plugin, you should use
libraryDependencies += "org.mongodb" % "mongodb-driver-async" % "3.2.1"
in your build.sbt file
docs here

using lifty (lift in action) with the latest version of scala

I am attempting to use lifty with the current version of scala.
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.lifty#lifty;1.7.4: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
I am using this configuration on windows in ~/.sbt/0.13/plugins/build.sbt
libraryDependencies +=
Defaults.sbtPluginExtra(
"org.lifty" % "lifty" % "1.7.4", "0.13.1", "2.10.4" )
How do I use the latest version of lifty with the current version of scala, I want to work through the examples with the newer version.
I also tried this configuration, but it also didn't seem to work with the new version
Lifty and SBT 0.12
Thanks.
I agree, lifty got abandoned by now. I actually think you can easily do what you want without it, just use something like a liftweb starting template: github.com/lift/lift_26_sbt – Vasya Novikov Apr 20 at 5:45

How to use scala-time?

somebody know scala-time? (https://github.com/jorgeortiz85/scala-time)
Have no idea how to use it. I can download it (on linux) and run sbt but theres always the same errormessage:
git clone git://github.com/jorgeortiz85/scala-time
cd scala-time
sbt
Getting org.scala-tools.sbt sbt_2.9.1 0.7.4 ...
:: problems summary ::
:::: WARNINGS
module not found: org.scala-tools.sbt#sbt_2.9.1;0.7.4
==== local: tried
/home/ll/.ivy2/local/org.scala-tools.sbt/sbt_2.9.1/0.7.4/ivys/ivy.xml
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:
/home/ll/.ivy2/local/org.scala-tools.sbt/sbt_2.9.1/0.7.4/jars/sbt_2.9.1.jar
==== Maven2 Local: tried
file:///home/ll/.m2/repository/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.pom
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:
file:///home/ll/.m2/repository/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.jar
==== typesafe-ivy-releases: tried
http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt_2.9.1/0.7.4/ivys/ivy.xml
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:
http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt_2.9.1/0.7.4/jars/sbt_2.9.1.jar
==== Maven Central: tried
http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.pom
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:
http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.jar
==== Scala-Tools Maven2 Repository: tried
http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.pom
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:
http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.jar
==== Scala-Tools Maven2 Snapshots Repository: tried
http://scala-tools.org/repo-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.pom
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.7.4!sbt_2.9.1.jar:
http://scala-tools.org/repo-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.7.4/sbt_2.9.1-0.7.4.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.scala-tools.sbt#sbt_2.9.1;0.7.4: not found
::::::::::::::::::::::::::::::::::::::::::::::
huh? Any other options?
To actually use it (as compared to building scala-time yourself), just add
libraryDependencies += "org.scala-tools.time" % "time_2.9.1" % "0.5"
to the build.sbt of the project you want to use it in.
Addition:
Current versions may want to use
libraryDependencies += "org.scalaj" %% "scalaj-time" % "0.6"
This is an sbt version problem, and you might be able to work around it by using a different sbt-launch or by changing the build a bit. I get a similar error if I use sbt-launch-0.10.1.jar for this code, but it works fine if I use sbt-launch-0.7.7.jar.
I'd suspect you're using sbt-launch-0.11.0, and this is causing sbt to look for a compiled version of sbt that doesn't in fact exist.
Possible fixes are:
Just use sbt-launch-0.7.7 for this code.
Edit the build.properties file to use a different version of sbt.
Get source for sbt-0.7.4, compile with scala 2.9.1 and stash the result in your local ivy repository with the name and location that's being searched.
Options 1 and 2 worked for me.
I haven't done #3 for this, but have done similar things for other code. It can be a bit painful...
You can have multiple versions of sbt-launch and flip between them depending on the needs of a particular codebase.
Perhaps someone who knows sbt better than I will post a real solution, but I'm hoping this is at least a little helpful.
Update or remove the sbt version(0.7.4) line from build.properties
That means there's no public version of SBT 0.7.4 compiled against Scala 2.9.1 by the looks of it.