Why can’t SBT resolve SecureSocial-snapshot dependency? - scala

I want to use this SecureSocial snapshot for my project:
https://oss.sonatype.org/content/repositories/snapshots/ws/securesocial/securesocial_2.11/master-SNAPSHOT/
However SBT is unable to resolve it. Here is the error message:
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/ws/securesocial/securesocial_2.11/master-SNAPSHOT/securesocial_2.11-master-SNAPSHOT.pom
[warn] ==== typesafe-releases: tried
[warn] http://repo.typesafe.com/typesafe/releases/ws/securesocial/securesocial_2.11/master-SNAPSHOT/securesocial_2.11-master-SNAPSHOT.pom
[warn] ==== typesafe-ivy-releasez: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/ws.securesocial/securesocial_2.11/master-SNAPSHOT/ivys/ivy.xml
[warn] ==== Typesafe Releases Repository: tried
[warn] https://repo.typesafe.com/typesafe/releases/ws/securesocial/securesocial_2.11/master-SNAPSHOT/securesocial_2.11-master-SNAPSHOT.pom
[info] Resolving jline#jline;2.12 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: ws.securesocial#securesocial_2.11;master-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
Here are my resolvers and library dependencies:
Build.scala:
libraryDependencies ++= Seq(
"org.webjars" %% "webjars-play" % "2.3.0-3",
"org.logback-extensions" % "logback-ext-loggly" % "0.1.2",
"ws.securesocial" % "securesocial_2.11" % "master-SNAPSHOT"
)
plugins.sbt:
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
resolvers += "Sonatype OSS Releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
As far as I can tell this should work, but it doesn’t. What is the cause of this problem?
Versions info:
Scala version: 2.11.5
SBT version: 0.13.8
Play version: 2.3.7

The resolvers that you add for libraries should go in the build.sbt, not in the plugins.sbt. These two files are not cascaded and if you see the output from sbt it is not even trying to connect to Sonatype. Move this line in the build.sbt and it should work:
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
It is worth noting that you need to add resolvers in the plugins.sbt only when you want to include an sbt plugin that is not in the default repos.

Related

SBT can't find and import cats-core

I'm starting a new project to try out Scala Cats, and my SBT seems to refuse to find the cats-core. It has no trouble bringing in something like ScalaTest, but whenever I try to refresh my sbt project with the cats-core as a libraryDependencies, it claims it is an unresolved dependency, looking into the error, it says:
[warn] module not found: org.typelevel#cats-core_2.13;2.0.0-M2
[warn] ==== local: tried
[warn] /Users/me/.ivy2/local/org.typelevel/cats-core_2.13/2.0.0-M2/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/org/typelevel/cats-core_2.13/2.0.0-M2/cats-core_2.13-2.0.0-M2.pom
[warn] ==== local-preloaded-ivy: tried
[warn] /Users/me/.sbt/preloaded/org.typelevel/cats-core_2.13/2.0.0-M2/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////Users/me/.sbt/preloaded/org/typelevel/cats-core_2.13/2.0.0-M2/cats-core_2.13-2.0.0-M2.pom
[warn] ==== cats-core: tried
[warn] https://mvnrepository.com/artifact/org.typelevel/cats-core/org/typelevel/cats-core_2.13/2.0.0-M2/cats-core_2.13-2.0.0-M2.pom
My build.sbt looks like this:
scalaVersion := "2.13.0"
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.0.0-M2",
"org.scalatest" %% "scalatest" % "3.0.8" % Test
)
resolvers += "cats-core" at "https://mvnrepository.com/artifact/org.typelevel/cats-core" // it gives the same errors without this line
scalacOptions ++= Seq("-Xfatal-warnings","-Ypartial-unification")
val exportFullResolvers = taskKey[Unit]("debug resolvers")
exportFullResolvers := {
for {
(resolver,idx) <- fullResolvers.value.zipWithIndex
} println(s"${idx}. ${resolver.name}")
}
Any idea how to bring it in?
The error is pretty explicit module not found: org.typelevel#cats-core_2.13;2.0.0-M2
What I do is then just search (google) for mavenrepo cats-core
Usually the top result will lead you to
https://mvnrepository.com/artifact/org.typelevel/cats-core
Or on on (sometimes this site is easier, when navigating scala versions):
https://index.scala-lang.org/typelevel/cats/cats-core

libraryDependencies for com.eed3si9n#sbt-assembly;0.13.0: not found

I am building a sbt plugin and want to reference assembly task in the sbt-assembly plugin ( to be dependent on my task)
to do this i need to reference it as a library ( as opposed to a plugin), and somehow sbt is not able to resolve it as a libraryDepdendencies
this is what my sbt looks like
sbtPlugin := true
name := "my-sbt-plugin"
scalaVersion := "2.10.6"
sbtVersion := "0.13.0"
resolvers ++= Seq(Resolver.sbtPluginRepo("releases"), Resolver.sbtPluginRepo("snapshots"))
libraryDependencies ++= Seq(
"com.eed3si9n" % "sbt-assembly" % "0.13.0")
the output looks like
Resolving com.eed3si9n#sbt-assembly;0.13.0 ...
[warn] module not found: com.eed3si9n#sbt-assembly;0.13.0
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== local: tried
[warn] /Users/myuser/.ivy2/local/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/eed3si9n/sbt-assembly/0.13.0/sbt-assembly-0.13.0.pom
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[warn] ==== sbt-plugin-snapshots: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots/com.eed3si9n/sbt-assembly/0.13.0/ivys/ivy.xml
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.eed3si9n#sbt-assembly;0.13.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
It is not resolving because you did not specify a scala version. It should be something like:
libraryDependencies ++= Seq(
"com.eed3si9n" % "sbt-assembly_2.11" % "0.13.0"
)
Or, to automatically get the scala version used in project:
libraryDependencies ++= Seq(
// notice the double %% here
"com.eed3si9n" %% "sbt-assembly" % "0.13.0"
)
But, sbt-assembly is not supposed to be installed that way. The docs show that you must add the following line to your project/plugins.sbt instead:
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.2")
If developing an sbt plugin, the addSbtPlugin line has to go directly into ./build.sbt.
In my case, correcting the sbt assembly version from 14.3 to 14.5 did the trick. Please check what's yours and try that.
So in the project\assembly.sbt , it was like-
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.3")
Then I changed it to-
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
Hope it helps!
It is not resolving for Scala - 2.12.
Add the following line in - project/plugins.sbt -
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
resolvers += Resolver.url("bintray-sbt-plugins", url("http://dl.bintray.com/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
To find the proper path, try the following -
https://dl.bintray.com/sbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_<version>/
So, using version 2.12, the resolvable path can be found as below -
https://dl.bintray.com/sbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.5/ivys/
In addition to the above suggestions I had to add
resolvers += Resolver.url("bintray-sbt-plugins", url("http://dl.bintray.com/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
to project/plugins.sbt.
I had the same issues, All I did was, remove the ==>
addSbtPlugin("com.eed3si9n" %% "sbt-assembly" % "0.14.5")
line from build.sbt and copied to another file, named assembly.sbt at the same project level, where build.sbt is.
It resolved the error.(After 3 hours of reading all posts on the internet. :-) )

Unresolved dependency SBT, scalariform

I am receiving this compilation error:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.sbt#sbt-scalariform;1.3.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.typesafe.sbt:sbt-scalariform:1.3.0 (scalaVersion=2.11, sbtVersion=0.13)
[warn]
In the root of my project I have a build.sbt file:
scalaVersion in ThisBuild := "2.11.6"
I also have a core/build.sbt file with several resolvers, libraryDependencies, and exclusions.
project/plugins.sbt:
addSbtPlugin(...)
resolvers += "Typesafe Public Repo" at "http://repo.typesafe.com/typesafe/releases"
resolvers += "JBoss Repository" at "http://repository.jboss.org/nexus/content/groups/public//"
~/.sbt/0.13/global.sbt
scalaVersion := "2.11.6"
You need to remove scalaVersion := "2.11.6" from ~/.sbt/0.13/global.sbt.
In sbt 0.13, sbt and its ecosystem of plugins is current using Scala 2.10.
The sbt-scalariform changed the groupId/organization
1.3.0 - "com.typesafe.sbt" % "sbt-scalariform" % "1.3.0"
available only for scala 2.9.1, 2.9.2 and 2.10
sbt 0.13
as seen here: https://dl.bintray.com/sbt/sbt-plugin-releases/com.typesafe.sbt/sbt-scalariform/scala_2.10/sbt_0.13/1.3.0/
1.4.0, 1.5.0, ... , 1.8.2 - "org.scalariform" % "sbt-scalariform" & "1.8.2"
https://repo1.maven.org/maven2/org/scalariform/sbt-scalariform_2.10_0.13/
https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22sbt-scalariform%22

Unresolved `restlet` sbt dependency

I am trying to add the blueprints-sail-graph (located here) dependency via sbt, and it is having trouble resolving one of the sail dependencies. I am new to Java/Scala development and will really appreciate your help! The following is my build.sbt file:
scalaVersion := "2.10.3"
libraryDependencies ++= Seq(
"org.scalatest" % "scalatest_2.10" % "2.0" % "test" withSources() withJavadoc(),
"org.scalacheck" %% "scalacheck" % "1.10.0" % "test" withSources() withJavadoc(),
"com.tinkerpop.blueprints" % "blueprints-rexster-graph" % "2.6.0" withSources() withJavadoc(),
"com.tinkerpop.blueprints" % "blueprints-sail-graph" % "2.5.0"
)
unmanagedBase := baseDirectory.value / "lib"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
resolvers += "Scala-Tools Maven2 Snapshots Repository" at "http://scala-tools.org/repo-snapshots"
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository"
resolvers += "JBoss repository" at "https://repository.jboss.org/nexus/content/repositories/"
The error I get from sbt is:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.restlet.jse#org.restlet;2.1.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: org.restlet.jse#org.restlet;2.1.1: not found
The warnings above this error message are:
[info] Resolving org.restlet.jse#org.restlet;2.1.1 ...
[warn] module not found: org.restlet.jse#org.restlet;2.1.1
[warn] ==== local: tried
[warn] /home/d2b2/.ivy2/local/org.restlet.jse/org.restlet/2.1.1/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/restlet/jse/org.restlet/2.1.1/org.restlet-2.1.1.pom
[warn] ==== Sonatype OSS Snapshots: tried
[warn] https://oss.sonatype.org/content/repositories/snapshots/org/restlet/jse/org.restlet/2.1.1/org.restlet-2.1.1.pom
[warn] ==== Scala-Tools Maven2 Snapshots Repository: tried
[warn] http://scala-tools.org/repo-snapshots/org/restlet/jse/org.restlet/2.1.1/org.restlet-2.1.1.pom
[warn] ==== Local Maven Repository: tried
[warn] file:///home/d2b2/.m2/repository/org/restlet/jse/org.restlet/2.1.1/org.restlet-2.1.1.pom
[warn] ==== JBoss repository: tried
[warn] https://repository.jboss.org/nexus/content/repositories/org/restlet/jse/org.restlet/2.1.1/org.restlet-2.1.1.pom
I know that the sail dependency is the issue becuase if I remove it, sbt compiles without a problem. I added the additional resolvers hoping that one of them would contain this jar -- in fact JBoss appears to, but for some reason it still did not work. I also tried many different versions of blueprints-sail-graph unsuccessfully. I am not sure what else to do, please help me get this dependency resolved.
Thanks for all the help!
EDIT: According to another post, this jar needs to be specifically added to Ivy -- hope that saves someone some time. I tried a few things with Ivy but did not succeed :(
Add the following to list of resolvers:
resolvers += "Restlet Repositories" at "http://maven.restlet.org"
By the way you can use sbt predefined attributes. The whole sbt build file will be like this:
import sbt.Resolver.mavenLocal
scalaVersion := "2.10.3"
unmanagedBase := baseDirectory.value / "lib"
resolvers ++= Seq(
mavenLocal,
"Restlet Repository" at "http://maven.restlet.org/",
"JBoss Repository" at "https://repository.jboss.org/nexus/content/repositories/",
"Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/",
"Scala-Tools Snapshots" at "http://scala-tools.org/repo-snapshots/"
)
libraryDependencies ++= Seq(
"org.scalatest" % "scalatest_2.10" % "2.0" % "test" withSources() withJavadoc(),
"org.scalacheck" %% "scalacheck" % "1.10.0" % "test" withSources() withJavadoc(),
"com.tinkerpop.blueprints" % "blueprints-rexster-graph" % "2.6.0" withSources() withJavadoc(),
"com.tinkerpop.blueprints" % "blueprints-sail-graph" % "2.5.0"
)

What is the repository for scrooge-sbt-plugin?

What is the repository for the current version of scrooge-sbt-plugin? Or are the setup instructions outdated?
According to the documentation, I added this to a Play Framework project:
In project/plugins.sbt
addSbtPlugin("com.twitter" %% "scrooge-sbt-plugin" % "3.3.2")
In build.sbt:
com.twitter.scrooge.ScroogeSBT.newSettings
libraryDependencies ++= Seq(
"org.apache.thrift" % "libthrift" % "0.8.0",
"com.twitter" %% "scrooge-core" % "3.3.2",
"com.twitter" %% "finagle-thrift" % "6.5.0"
)
After play clean-all and play-compile I get this output:
[warn] module not found: com.twitter#scrooge-sbt-plugin;3.3.2
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/com.twitter/scrooge-sbt-plugin/scala_2.10/sbt_0.13/3.3.2/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.twitter/scrooge-sbt-plugin/scala_2.10/sbt_0.13/3.3.2/ivys/ivy.xml
[warn] ==== local: tried
[warn] /opt/play-2.2.0/repository/local/com.twitter/scrooge-sbt-plugin/scala_2.10/sbt_0.13/3.3.2/ivys/ivy.xml
[warn] ==== Maven2 Local: tried
[warn] file:/home/fernando/.m2/repository/com/twitter/scrooge-sbt-plugin_2.10_0.13/3.3.2/scrooge-sbt-plugin-3.3.2.pom
[warn] ==== sonatype-oss-snapshots: tried
[warn] http://oss.sonatype.org/content/repositories/snapshots/com/twitter/scrooge-sbt-plugin_2.10_0.13/3.3.2/scrooge-sbt-plugin-3.3.2.pom
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/com/twitter/scrooge-sbt-plugin_2.10_0.13/3.3.2/scrooge-sbt-plugin-3.3.2.pom
[warn] ==== Typesafe repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/com/twitter/scrooge-sbt-plugin_2.10_0.13/3.3.2/scrooge-sbt-plugin-3.3.2.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.twitter#scrooge-sbt-plugin;3.3.2: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.twitter:scrooge-sbt-plugin:3.3.2 (sbtVersion=0.13, scalaVersion=2.10)
[warn]
sbt.ResolveException: unresolved dependency: com.twitter#scrooge-sbt-plugin;3.3.2: not found
There seems to be a version 3.3.1 at maven.twttr.com. What about version 3.3.2? I couldn't find it at mvnrepository.com or oss.sonatype.org.
The repository is on https://oss.sonatype.org/content/groups/public.
With a look into the Build.scala you can find out to which repository they publish.
If you look into https://oss.sonatype.org/content/groups/public/com/twitter/ and search for "scrooge-sbt-plugin" you fill find folders that ends with "_0.12", so it is published there as SBT 0.12.x plugin. You probably can't use this plugin for Play 2.2.x since it uses SBT 0.13.x.
Version 3.3.2 is not the latest release and I had problems to resolve all files. Using 3.9.2 works:
project/build.properties mus contain SBT 0.12 (example):
sbt.version=0.12.2
project/plugins.sbt must contain the resolver:
resolvers += "sonatype" at "https://oss.sonatype.org/content/groups/public"
addSbtPlugin("com.twitter" %% "scrooge-sbt-plugin" % "3.9.2")
And finally build.sbt or Build.scala must contain:
com.twitter.scrooge.ScroogeSBT.newSettings
scalaVersion := "2.10.1"
libraryDependencies ++= Seq(
"org.apache.thrift" % "libthrift" % "0.8.0",
"com.twitter" %% "scrooge-core" % "3.9.2",
"com.twitter" %% "finagle-thrift" % "6.5.0"
)
First of all, version 3.16.3 is the latest version for sbt 0.13.x
What do you mean by repository?
The code repository is on GitHub, all of the Scrooge stuff including the sbt-plugin stuff are all there.
As for the artifact repository, I am pretty sure it's on maven central or some other standard repo. You should not have to add a resolver to your sbt build. But if you do for some reason than the sonatype one mentioned by #Schleichardt seems about right.