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
Related
Following simple SBT fails to import org.lwjglx / lwjgl3-awt:
name := "LWJGLTest"
version := "0.1"
scalaVersion := "2.12.8"
libraryDependencies += "org.lwjglx" % "lwjgl3-awt" % "0.1.5"
The error is:
[warn] Detected merged artifact: [FAILED ] org.lwjgl#lwjgl-opengl;3.2.2!lwjgl-opengl.jar: (0ms).
[warn] Detected merged artifact: [FAILED ] org.lwjgl#lwjgl;3.2.2!lwjgl.jar: (0ms).
[warn] ==== public: tried
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/org/lwjgl/lwjgl-opengl/3.2.2/lwjgl-opengl-3.2.2-natives-${platform}.jar
[warn] https://repo1.maven.org/maven2/org/lwjgl/lwjgl/3.2.2/lwjgl-3.2.2-natives-${platform}.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: FAILED DOWNLOADS ::
[warn] :: ^ see resolution messages for details ^ ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.lwjgl#lwjgl;3.2.2!lwjgl.jar
[warn] :: org.lwjgl#lwjgl-opengl;3.2.2!lwjgl-opengl.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] sbt.librarymanagement.ResolveException: download failed: org.lwjgl#lwjgl;3.2.2!lwjgl.jar
[error] download failed: org.lwjgl#lwjgl-opengl;3.2.2!lwjgl-opengl.jar
Is this an issue with SBT, or with the lwjgl3-awt artifact? Is there some way how to work around it?
For a comparison, following sbt loads fine:
name := "LWJGLTest"
version := "0.1"
scalaVersion := "2.12.8"
libraryDependencies += "org.lwjgl" % "lwjgl" % "3.2.2"
libraryDependencies += "org.lwjgl" % "lwjgl-opengl" % "3.2.2"
Following workaround allows to proceed by specifying the necessary dependencies manually:
libraryDependencies += "org.lwjgl" % "lwjgl" % "3.2.2"
libraryDependencies += "org.lwjgl" % "lwjgl-opengl" % "3.2.2"
libraryDependencies += "org.lwjglx" % "lwjgl3-awt" % "0.1.5" excludeAll ExclusionRule("org.lwjgl")
I think the problem is SBT somehow does not understand the ${platform} in the pom.xml. The solution above prevents it trying to resolve those dependencies, which is why they are provided explicitly.
I am trying to add a dependency to json4, but I get a module not found error. I am using scala-version 2.12.4 and sbt-version 1.1.1. My other dependency additions seem to add in a normal way.
Here is my code in build.sbt:
scalaVersion := "2.12.4"
libraryDependencies += "io.spray" %% "spray-json" % "1.3.4"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % Test
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.4" % Test
libraryDependencies += "org.json4s" %% "json4s-native" % "3.3.0"
This is the error message that I get:
[warn] module not found: org.json4s#json4s-native_2.12;3.3.0
[warn] ==== local: tried
[warn] /Users/*****/.ivy2/local/org.json4s/json4s-native_2.12/3.3.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/org/json4s/json4s-native_2.12/3.3.0/ json4s-native_2.12-3.3.0.pom
[warn] ==== local-preloaded-ivy: tried
[warn] /Users/*****/.sbt/preloaded/org.json4s/json4s-native_2.12/3.3.0/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////Users/*****/.sbt/preloaded/org/json4s/json4s-native_2.12/3.3.0/ json4s-native_2.12-3.3.0.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.json4s#json4s-native_2.12;3.3.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
Help appreciated, thanks!
You need to use a newer version of this library.
Try this:
libraryDependencies += "org.json4s" %% "json4s-native" % "3.6.0-M3"
or some earlier version but not 3.3.0
Link to versions:
http://search.maven.org/#search%7Cga%7C2%7Cg%3A%22org.json4s%22
Edit: This problem is with compatibility. You use a new version of Scala and sbt. Previous version of this library are not compatible with this Scala version or sbt version.
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.
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. :-) )
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.