Using SBT to load Datomic Pro peer library? - scala

Has anyone had any success with using SBT to download and manage the Datomic Pro peer library? Datomic's website gives clear instructions for Leiningen and Maven, but not SBT. Translating the Leiningen instructions, I came up with the following additions to my build.sbt file.
resolvers += "my.datomic.com" at "https://my.datomic.com/repo"
credentials += Credentials(realm = "restricted area",
host = "my.datomic.com",
userName = ...,
passwd = ...)
libraryDependencies ++= Seq(
"com.datomic" % "datomic-pro" % "0.9.4752",
...
)
Note that I came up with the weird "restricted area" realm by running curl -X GET https://my.datomic.com/repo/com/datomic/datomic-pro/0.9.4752/datomic-pro-0.9.4752.pom -v and saw WWW-Authenticate: Basic realm="restricted area". That was the one piece of information that was not documented on the Datomic website.
Running the aforementioned build results in the dreaded UNRESOLVED DEPENDENCIES error.
[warn] ==== my.datomic.com: tried
[warn] https://my.datomic.com/repo/com/datomic/datomic-pro/0.9.4752/datomic-pro-0.9.4752.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.datomic#datomic-pro;0.9.4752: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: com.datomic#datomic-pro;0.9.4752: not found
Note that the URL it's trying to download from is indeed correct. I can download the POM using wget and it works fine (supplying the user name and password, of course).
I should also mention that I'm using SBT 0.13.5-M2 Has anyone gotten this to work? Any help would be greatly appreciated!
Edit:
As per Eugene's suggestion below, I tried running I tried running with --debug to see if I can get any additional info, but couldn't find any smoking gun. Output below:
[0m[[0mdebug[0m] [0m CLIENT ERROR: Not Found url=https://my.datomic.com/repo/com/datomic/datomic-pro/0.9.4752/datomic-pro-0.9.4752.pom[0m
[0m[[0mdebug[0m] [0m my.datomic.com: no ivy file found for com.datomic#datomic-pro;0.9.4752[0m
[0m[[33mwarn[0m] [0m module not found: com.datomic#datomic-pro;0.9.4752[0m

The issue was that my.datomic.com did not support HEAD requests. The Datomic folks have since fixed this.

Related

Scala Play Framework download failed: com.typesafe.play#play_2.10;2.2.6!play_2.10.jar

I'm working with one of the old Scala project created using Play Framework 2.2.6. I'm trying to build and run the project locally. But, facing this error whenever I run play clean compile.
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: FAILED DOWNLOADS ::
[warn] :: ^ see resolution messages for details ^ ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.play#play_2.10;2.2.6!play_2.10.jar(src)
[warn] :: com.typesafe.play#play-test_2.10;2.2.6!play-test_2.10.jar(src)
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: download failed: com.typesafe.play#play_2.10;2.2.6!play_2.10.jar(src)
download failed: com.typesafe.play#play-test_2.10;2.2.6!play-test_2.10.jar(src)
Following are the repos, I've set in ~/.sbt/repositories.
[repositories]
maven-central: https://repo1.maven.org/maven2/
typesafe-repo: https://repo.typesafe.com/typesafe/maven-releases
ivy-repo: https://repo.typesafe.com/typesafe/ivy-releases
Not sure how to download these two specific mentioned in error.
In Maven, the organization com.typesafe.play is closed, the repository is not available anymore.
Two choices:
Build or find private play repositories
Migrate to more recent play version (https://www.playframework.com/documentation/2.3.x/Migration23)
You are getting this error because Play Framework 2.2.6 has not been compiled and released against your current Scala version which is 2.10 (check here). You should probably use different versions.

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

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.

Cannot install new 0.11.3 sbt on Ubuntu 10.04LTS

This process used to work fine in 0.11.2 but the recent change w.r.t to sbt group ID changed to org.scala-sbt (from org.scala-tools.sbt) seems to have broken a dependency.
I've got a 10.04 LTS machine to which I added the Typesafe deb repository using the deb package file, described in: https://github.com/harrah/xsbt/wiki/Getting-Started-Setup.
When I try to install from the repo I get:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-tools.sbt#scripted-plugin_2.9.1;0.11.3: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] module not found: org.scala-tools.sbt#scripted-plugin_2.9.1;0.11.3
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/scripted-plugin_2.9.1/0.11.3/ivys/ivy.xml
[warn] ==== local: tried
[warn] /home/jasonmaclulich/.ivy2/local/org.scala-tools.sbt/scripted-plugin_2.9.1/0.11.3/ivys/ivy.xml
[warn] ==== Typesafe Repo: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.scala-tools.sbt/scripted- plugin_2.9.1/0.11.3/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scala-tools/sbt/scripted-plugin_2.9.1/0.11.3/scripted-plugin_2.9.1-0.11.3.pom
How do I instruct sbt to look for scripted-plugin at the right group id?
I also tried a manual install with this launcher (following the UNIX install instructions):
//typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.11.3-2/sbt-launch.jar
And I still get the following unresolved dependency:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-tools.sbt#scripted-plugin_2.9.1;0.11.3: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
Thoughts?
Thanks, Jason.
I thought I'd update this with how I got around it, if I explicitly set the version of sbt to 0.11.2 in my project/build.properties file, i.e., sbt.version=0.11.2.
Detected sbt version 0.11.2
Cannot find sbt launcher 0.11.2
Please download:
From http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-launch/0.11.2/sbt-launch.jar
To /home/<username>/.sbt/.lib/0.11.2/sbt-launch.jar
I then installed the required files and I was able to continue compiling like I was used to.
While it isn't a direct solution it does let me continue with work.
I've installed latest SBT on Ubuntu successfully, but indirectly, by installing Typesafe Stack.
By now, sbt-0.11.3-build-0100 is available (http://apt.typesafe.com/pool/pool/main/s/sbt/), so you should be able to simply upgrade to solve your problem. If that doesn't work or if you're curious about the original problem, here's my diagnosis.
As you tried to do, you do need to use a new launcher for SBT 0.11.3 to use the new group ID, org.scala-sbt. Your second error message still shows a failure which refers to org.scala-tools.sbt - that's bad, and suggests you're in fact still using the old launcher.
Could you make sure that when you're launching sbt, you're launching the script you created and not the one from the Debian package? Please try using the full path for launching sbt, for instance ~/bin/sbt.
If that helps, you should fix the PATH so that ~/bin (or wherever you installed your script) comes before the directory where the system SBT is installed, which (I would say, but it's a matter of opinion) is generally useful.