How is SBT determining the scalajs-react version to download - scala

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).

Related

Add a maven dependency to SBT project

I am trying to reference a maven project dependency in my build.sbt file. I understand I need to add an additional resolver to my file since the project is hosted in an internal artifactory store
build.sbt
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "2.4.4",
"org.apache.spark" %% "spark-sql" % "2.4.4",
"com.<companyname>" %% "<libraryname>" % "2.3.0"
)
resolvers += "<library name>" at "http://artifactory.<internal url>.io:80/dsc-mvn"
However, it turns out that SBT ends up searching for a path that has _2.11 version appended to it. This is the error message that I see in IntelliJ
[info] Loading settings for project sbt-demo from build.sbt ...
[warn] Discarding 1 session setting. Use 'session save' to persist session settings.
[info] Set current project to SparkExample (in build file:<project_path>)
[info] Defining Global / sbtStructureOptions
[info] The new value will be used by Global / ssOptions
[info] Reapplying settings...
[info] Set current project to SparkExample (in build file:<project_path>)
[info] Updating ...
[warn] module not found: com.<companyname>#<libraryname>_2.11;2.3.0
[warn] ==== local: tried
[warn] /Users/vshah/.ivy2/local/com.<companyname>/<libraryname>_2.11/2.3.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/<companyname>/<libraryname>_2.11/2.3.0/<libraryname>_2.11-2.3.0.pom
[warn] ==== local-preloaded-ivy: tried
[warn] /Users/vshah/.sbt/preloaded/com.<companyname>/<libraryname>_2.11/2.3.0/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////Users/vshah/.sbt/preloaded/com/<companyname>/<libraryname>_2.11/2.3.0/<libraryname>_2.11-2.3.0.pom
[warn] ==== <libraryname>: tried
[warn] http://artifactory.<internal url>.io:80/dsc-mvn/com/<companyname>/<libraryname>_2.11/2.3.0/<libraryname>_2.11-2.3.0.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.<companyname>#<libraryname>_2.11;2.3.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
Invalid Path (as the project is trying to search above)-
http://artifactory.<internal url>.io/dsc-mvn/com/<companyname>/<libraryname>_2.11/2.3.0/<libraryname>_2.11-2.3.0.pom
Valid path -
http://artifactory.<internal url>.io/dsc-mvn/com/<companyname>/<libraryname>/2.3.0/<libraryname>_2.11-2.3.0.pom
My question is how do I let SBT know that I am referencing a maven project at the above mentioned valid path?
This should work:
"com.<companyname>" % "<libraryname>" % "2.3.0"
The %% in the definition automatically appends the project scala version to the library name. Check out the official sbt documentation for more info.
refer to https://mvnrepository.com/artifact/org.scala-sbt to get the right Build tool for your project, and kindly check if the version in the dependency matches the version of your scala .
Can you please tell me more about the kind of dependency you need?

Why is ScalaTest 3.0.1 for 2.12 not resolved?

I have a scala project that is cross built for 2.11 and 2.12
crossScalaVersions := Seq("2.11.8", "2.12.0")
I've added dependency for scalatest.
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.1" % "test",
"org.mockito" % "mockito-all" % "1.10.19" % "test"
)
resolvers ++= Seq(
"Akka" at "http://akka.io/repository/",
"Sonatype" at "http://oss.sonatype.org/content/repositories/releases"
)
I can see that 2.12 version is published for scalatest from 3.0.0. SBT is not able to resolve it though.
[warn] ==== sbt-releases-repo: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.scalatest/scalatest_2.12/3.0.1/ivys/ivy.xml
[warn] ==== sbt-plugins-repo: tried
[warn] http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scalatest/scalatest_2.12/3.0.1/ivys/ivy.xml
[warn] ==== my-ivy-proxy-releases: tried
[warn] http://artifactory.internal.com/ivy-releases/org.scalatest/scalatest_2.12/3.0.1/ivys/ivy.xml
[warn] ==== my-maven-proxy-releases: tried
[warn] http://artifactory.internal.com/maven-releases/org/scalatest/scalatest_2.12/3.0.1/scalatest_2.12-3.0.1.pom [warn] ==== Akka: tried
[warn] http://akka.io/repository/org/scalatest/scalatest_2.12/3.0.1/scalatest_2.12-3.0.1.pom
[warn] ==== Sonatype: tried
[warn] http://oss.sonatype.org/content/repositories/releases/org/scalatest/scalatest_2.12/3.0.1/scalatest_2.12-3.0.1.pom [info] Resolving jline#jline;2.14.1 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scalatest#scalatest_2.12;3.0.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
Any pointers to what is missing here?
UPDATE:
Adding my ~/.sbt/repositories setting
[repositories]
local
my-ivy-proxy-releases: http://artifactory.internal.com/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
my-maven-proxy-releases: http://artifactory.internal.com/maven-releases/
According to your log, SBT doesn't search for the dependency on Maven Central, which is the most straightforward place to get Scalatest from. This is not an issue with a default SBT config (since Maven Central is one of the default resolvers); but here, you have a specific SBT config, to use your organization's internal repos instead (on http://artifactory.internal.com).
You need to either add Maven Central in your SBT resolvers (but that's probably not what you want, in the long term) or check with your Artifactory admins if the artifactory.internal.com/maven-releases repo is the one that's supposed to proxy Maven Central dependencies, and if it's properly configured. I think they should also be able to export from Artifactory a Maven configuration file pointing to the repos you need to use: you could then just copy and paste the URLs from that to your SBT config file.

Fail to upload to sonatype with sbt 0.13 with xsbt-gpg-plugin unresolved dependency: com.jsuereth#xsbt-gpg-plugin;0.6

my plugins.sbt has this:
logLevel := Level.Warn
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "1.0.0")
resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases")) (Resolver.ivyStylePatterns)
addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.6")
when i run sbt publish i get:
[warn] ==== sbt-plugin-releases: tried [warn]
http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/com.jsuereth/xsbt-gpg-plugin/scala_2.10/sbt_0.13/0.6/ivys/ivy.xml
[warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] ::
UNRESOLVED DEPENDENCIES :: [warn]
:::::::::::::::::::::::::::::::::::::::::::::: [warn] ::
com.jsuereth#xsbt-gpg-plugin;0.6: not found [warn]
:::::::::::::::::::::::::::::::::::::::::::::: [warn] [warn] Note:
Some unresolved dependencies have extra attributes. Check that these
dependencies exist with the requested attributes. [warn]
com.jsuereth:xsbt-gpg-plugin:0.6 (sbtVersion=0.13,
scalaVersion=2.10) [warn] sbt.ResolveException: unresolved
dependency: com.jsuereth#xsbt-gpg-plugin;0.6: not found at
sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:217) at
sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:126)
So I tried updating the addSbtPlugin to be:
addSbtPlugin("com.jsuereth" % "xsbt-gpg-plugin" % "0.6",
sbtVersion = "0.12", // SBT version
scalaVersion = "2.9.2" )
Now I get
[warn] The global sbt directory is now versioned and is located at /home//.sbt/0.13.
[warn] You are seeing this warning because there is global configuration in /home//.sbt but not in /home//.sbt/0.13.
[warn] The global sbt directory may be changed via the sbt.global.base system property.
[info] Loading project definition from /home//dev/projects/myproj/project
[warn] Multiple resolvers having different access mechanism configured with same name 'sbt-plugin-releases'. To avoid conflict, Remove duplicate project resolvers (`resolvers`) or rename publishing resolver (`publishTo`).
**java.lang.NoClassDefFoundError: sbt/Scoped$ListSetting**
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
anyway to fix it please?
thanks
Not sure, but I think you use a rather old version of that plugin?
I use the following with latest sbt 0.13.6. I have this globally installed in ~/.sbt/0.13/plugins/build.sbt:
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1") // sign Sonatype artifacts
I also left my credentials in ~/.sbt/0.13/sonatype.sbt:
credentials += Credentials("Sonatype Nexus Repository Manager",
"oss.sonatype.org",
"user-name", "pass-word")
This way I can do sbt publish-signed.
Here is the plugin documentation. (As you can see, there is already an even newer version available)

sbt and scct .... module not found: reaktor#sbt-scct;0.2-SNAPSHOT

scala is version 2.10.2 and sbt is 0.13.0
I am trying to setup scct for scala unit test code coverage so in build.sbt
I added
seq(ScctPlugin.instrumentSettings : _*)
and in project/plugins.sbt I added
resolvers += Classpaths.typesafeResolver
resolvers += "scct-github-repository" at "http://mtkopone.github.com/scct/maven-repo"
addSbtPlugin("reaktor" %% "sbt-scct" % "0.2-SNAPSHOT")
I get errors like ....
module not found: reaktor#sbt-scct;0.2-SNAPSHOT
Last message is
[warn] ==== scct-github-repository: tried
[warn] http://mtkopone.github.com/scct/maven-repo/reaktor/sbt-scct_2.10_0.13/0.2-SNAPSHOT/sbt-scct-0.2-SNAPSHOT.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: reaktor#sbt-scct;0.2-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] reaktor:sbt-scct:0.2-SNAPSHOT (sbtVersion=0.13, scalaVersion=2.10)
I look in http://mtkopone.github.io/scct/maven-repo/reaktor/
and I see the one I seem to need is missing e.g. I see
sbt-scct_2.9.2_0.13/
scct_2.10/
and a bunch of others but no ... sbt-scct_2.10_0.13
Can you help ? (I am a sbt newbie)
SCCT has a new source code repository: https://github.com/SCCT/scct
As a result you can fetch a release version from maven central with addSbtPlugin("com.github.scct" %% "sbt-scct" % "0.2") in your plugins.sbt file.
My project to reproduce is on GitHub.
Update:
The repository has been relocated at https://github.com/sqality/scct
and you need addSbtPlugin("com.sqality.scct" % "sbt-scct" % "version") in your plugins.sbt file.
The original SCCT is inactive now.
Here are the two most active forks.
http://github.com/sqality
http://github.com/scoverage

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.