How to use scala-time? - scala

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.

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

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

Understanding How SBT, Scala, SBT-Idea and Play Framework Work Together

I am new and had built some simple Scala applications / tutorials using SBT. I move on to Play framework and generated an empty project using g8 typesafehub/play-scala. I did a few tests to make sure it was properly generated. That checked out good and I added sbt-idea plugin, https://github.com/mpeltonen/sbt-idea, to generate an IntelliJ project. This is where the hell broke loose.
I had to find the right Scala, SBT, Play framework and sbt-idea versions combinations to get it compiled perfectly. Otherwise, the compilation would broke with out right errors or warnings that got me guessing. So far, the best "combination" I had was
Scala 2.9.2
Play 2.0.1
SBT 0.11.2
sbt-idea 1.1.0
with the following warning
[warn] [NOT FOUND ] maven-plugins#maven-cobertura-plugin;1.3!maven-cobertura-plugin.plugin (282ms)
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/maven-plugins/maven-cobertura-plugin/1.3/maven-cobertura-plugin-1.3.plugin
[warn] [NOT FOUND ] maven-plugins#maven-findbugs-plugin;1.3.1!maven-findbugs-plugin.plugin (284ms)
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/maven-plugins/maven-findbugs-plugin/1.3.1/maven-findbugs-plugin-1.3.1.plugin
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: FAILED DOWNLOADS ::
[warn] :: ^ see resolution messages for details ^ ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: maven-plugins#maven-cobertura-plugin;1.3!maven-cobertura-plugin.plugin
[warn] :: maven-plugins#maven-findbugs-plugin;1.3.1!maven-findbugs-plugin.plugin
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
If I use the latest versions, SBT 0.12 and Play 2.0.3 I would get a complilating error. Any idea or explanation how I can get all these works together nicely? It is a version mess to me right now. Thanks
I think that you should start with Play from the original site: http://www.playframework.org/ you'll find there newest stable version for download (currently it's 2.0.3).
It contains proper dependencies and its installation is as easy as unpacking the ZIP and exporting the path as described in: Installing doc.
I can ensure you that this approach is the easiest and most sure way, it works as expected, creates proper IntelliJ projects etc. If I'm not wrong IntelliJ support was fixed after 2.0.1 also other indices had some improvements, so there is no sense to fight with 2.0.1 if it isn't really required.

Lift - Setting it up

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.

scala-redis requires sbt 0.10.1 (other versions don't work) - is that normal?

While trying out the Scala bindings for Redis, I followed the instructions in the README file (clone the repo, cd into it, type sbt) and I got this:
$ sbt
Getting org.scala-tools.sbt sbt_2.9.1 0.10.1 ...
:: problems summary ::
:::: WARNINGS
module not found: org.scala-tools.sbt#sbt_2.9.1;0.10.1
==== local: tried
/Users/noah/.ivy2/local/org.scala-tools.sbt/sbt_2.9.1/0.10.1/ivys/ivy.xml
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.10.1!sbt_2.9.1.jar:
/Users/noah/.ivy2/local/org.scala-tools.sbt/sbt_2.9.1/0.10.1/jars/sbt_2.9.1.jar
==== Maven2 Local: tried
file:///Users/noah/.m2/repository/org/scala-tools/sbt/sbt_2.9.1/0.10.1/sbt_2.9.1-0.10.1.pom
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.10.1!sbt_2.9.1.jar:
file:///Users/noah/.m2/repository/org/scala-tools/sbt/sbt_2.9.1/0.10.1/sbt_2.9.1-0.10.1.jar
==== typesafe-ivy-releases: tried
http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt_2.9.1/0.10.1/ivys/ivy.xml
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.10.1!sbt_2.9.1.jar:
http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt_2.9.1/0.10.1/jars/sbt_2.9.1.jar
==== Maven Central: tried
http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt_2.9.1/0.10.1/sbt_2.9.1-0.10.1.pom
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.10.1!sbt_2.9.1.jar:
http://repo1.maven.org/maven2/org/scala-tools/sbt/sbt_2.9.1/0.10.1/sbt_2.9.1-0.10.1.jar
==== Scala-Tools Maven2 Repository: tried
http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt_2.9.1/0.10.1/sbt_2.9.1-0.10.1.pom
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.10.1!sbt_2.9.1.jar:
http://scala-tools.org/repo-releases/org/scala-tools/sbt/sbt_2.9.1/0.10.1/sbt_2.9.1-0.10.1.jar
==== Scala-Tools Maven2 Snapshots Repository: tried
http://scala-tools.org/repo-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.10.1/sbt_2.9.1-0.10.1.pom
-- artifact org.scala-tools.sbt#sbt_2.9.1;0.10.1!sbt_2.9.1.jar:
http://scala-tools.org/repo-snapshots/org/scala-tools/sbt/sbt_2.9.1/0.10.1/sbt_2.9.1-0.10.1.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.scala-tools.sbt#sbt_2.9.1;0.10.1: not found
::::::::::::::::::::::::::::::::::::::::::::::
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-tools.sbt#sbt_2.9.1;0.10.1: not found
Error during sbt execution: Error retrieving required libraries
(see /Users/noah/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.10.1
This was using sbt 0.7.4. I tried downloading the latest version of sbt (0.11.0) and I got the same problem. Then I manually downloaded sbt-launcher.jar from the 0.10.1 release of sbt, and that worked.
My question is: is sbt supposed to automatically download the required version of itself, or am I going to have to manually download & run different versions of sbt for packages which require different versions?
The error message seems unrelated to Redis.
Yes, SBT is supposed to download the appropriate version of itself. You can find out what versions of SBT are available by pointing your browser to: http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/ You will see that Scala 2.8.1 is tied to SBT versions <= 0.10.1, whereas Scala 2.9.1 is (currently) compatible with SBT 0.11.0 only.
You're getting this error message because somehow you're trying to get SBT 0.10.1 for Scala 2.9.1, which is an invalid combination. Not sure how you did this.. maybe you edited some internal SBT config files in the directory ~/.sbt/? If you want to get a "virgin" SBT, you can delete ~/.sbt/ and download the latest sbt-launch.jar. If you want to use a previous version of SBT, you can edit the project/build.properties file, as described on the Wiki.