sbt.librarymanagement.ResolveException: unresolved dependency: com.eed3si9n#sbt-assembly;0.14.6: not found - sbt

I am facing issue while using sbt-assembly to build my jar. I have gone through almost all the post available but it did not help resolve my issue.
Below is my build.sbt -
name := "test"
version := "0.1"
scalaVersion := "2.11.8"
sbtVersion := "1.3.6"
assembly.sbt -
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")
plugins.sbt -
resolvers += Resolver.url("bintray-sbt-plugins", url("http://dl.bintray.com/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
error:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.eed3si9n#sbt-assembly;0.14.6: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.eed3si9n:sbt-assembly:0.14.6 (scalaVersion=2.12, sbtVersion=1.0)
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.eed3si9n:sbt-assembly:0.14.6 (scalaVersion=2.12, sbtVersion=1.0)
During initial build, it is not downloading below files -
https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.6/ivys/ivy.xml
NaN% [ ] 0 B (0 B / s)
https://repo.typesafe.com/typesafe/ivy-releases/com.eed3si9n/sbt-assembly/scala_2.12/sbt_1.0/0.14.6/ivys/ivy.xml
NaN% [ ] 0 B (0 B / s)
and at the end it says [error] not found:
https://repo1.maven.org/maven2/com/eed3si9n/sbt-assembly_2.12_1.0/0.14.6/sbt-assembly-0.14.6.pom
ivy.xml files exists in given path but the repo1.maven.org path does not exists.
Has anyone faced similar issue?

Related

sbt: publishing plugin to and resolving from local repo

I am trying to publish an sbt plugin to a local file repo. In the plugin's build.sbt I have:
publishTo := Some(Resolver.file("localtrix", file("/Users/jast/repo/localtrix")))
I run the publish task and it gets published fine to
/Users/jast/repo/localtrix/org/me/sbt-plugin_2.12_1.0/1.2.3
In another project, I want to resolve this plugin. in project/plugins.sbt I have:
resolvers += Resolver.file("localtrix", file("/Users/jast/repo/localtrix"))
addSbtPlugin("org.me" % "sbt-plugin" % "1.2.3")
I try to run sbt in the this project and I get:
[info] Updating ProjectRef(uri("file:/Users/jast/playspace/untitled38/project/"), "untitled38-build")...
[warn] module not found: org.me#sbt-plugin;1.2.3
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/org.me/sbt-plugin/scala_2.12/sbt_1.0/1.2.3/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.me/sbt-plugin/scala_2.12/sbt_1.0/1.2.3/ivys/ivy.xml/2017.2+4-3037ba82+20180314-1919/ivys/ivy.xml
[warn] ==== local: tried
[warn] /Users/jast/.ivy2/local/org.me/sbt-plugin/scala_2.12/sbt_1.0/1.2.3/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/org/me/sbt-plugin_2.12_1.0/1.2.3/sbt-plugin-1.2.3.pom
[warn] ==== local-preloaded-ivy: tried
[warn] /Users/jast/.sbt/preloaded/org.me/sbt-plugin/scala_2.12/sbt_1.0/1.2.3/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////Users/jast/.sbt/preloaded/org/me/sbt-plugin_2.12_1.0/1.2.3/sbt-plugin-1.2.3.pom
[warn] ==== localtrix: tried
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.me#sbt-plugin;1.2.3: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
So how can I publish to a local repo it in a way that also gets resolved correctly?
Note: publishLocal and resolving from .ivy2/local works, but I want to be able to publish to a repo that I can copy to another machine without messing with that directory.
sbt plugins by default are published ivy-style, so you when you refer to your local repository, use Resolver.ivyStylePatterns. To publish:
publishTo := Some(Resolver.file("localtrix", file("/Users/jast/repo/localtrix"))(Resolver.ivyStylePatterns))
And to resolve:
resolvers += Resolver.file("localtrix", file("/Users/jast/repo/localtrix"))(Resolver.ivyStylePatterns)
addSbtPlugin("org.me" % "sbt-plugin" % "1.2.3")
Alternatively you can set publishMavenStyle := true for the plugin, but I see that you already figured that out.
You missed scala version in name. And you have also strange suffix in plugin name _1.0 in your published artifact, so just fixing scala version could be not enough.
This should work.
addSbtPlugin("org.me" % "sbt-plugin_2.12_1.0" % "1.2.3")
If you find out where came this suffix _1.0 from, fix on scala version should help:
addSbtPlugin("org.me" %% "sbt-plugin" % "1.2.3")
Update after comment
Ok, thanks, I did not know that for plugins it works differently.
But try to define resolver differently for resolvers (works for me):
resolvers += "localtrix" at "file:///Users/jast/repo/localtrix"
addSbtPlugin("org.me" % "sbt-plugin" % "1.2.3")

Sbt plugin publication and resolution on bintray, different paths (sbt-bintray plugin)

I have some troubles to publish/use a custom sbt plugin from bintray. I'm able
to publish sbt-plugin on bintray but when I try to use it the resolver uses
another path.
I have followed the official guide but adapted it to the latest version of the plugin, I have this build.sbt into my plugin :
lazy val commons = Seq(
organization in ThisBuild := "me.my.app",
version in ThisBuild := "0.1.0"
)
lazy val root = (project in file(".")).
settings(commons ++ BintrayPlugin.bintrayPublishSettings: _*).
settings(
sbtPlugin := true,
name := "sbt-plugin",
description := "Share configuration and plugins accros app projects",
bintrayOmitLicense := true,
publishMavenStyle := false,
bintrayRepository := "sbt-plugins",
bintrayOrganization := None
).
settings(
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0"),
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0"),
addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "0.8.0")
)
The sbt-plugin> publish task complete successfully and publish my plugin into
me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/jars/sbt-plugin.jar
Then I add addSbtPlugin("me.my.app" % "sbt-plugin" % "0.1.0") to my-project\project\plugins.sbt and
reload it. But he fail with
[warn] ==== bintray-{organization}-{repo}: tried
[warn] https://dl.bintray.com/{organization}/sbt-plugins/me/my/app/sbt-plugin_2.10_0.13/0.1.0/sbt-plugin-0.1.0.pom
...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: me.my.app#sbt-plugin;0.1.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] me.my.app:sbt-plugin:0.1.0 (scalaVersion=2.10, sbtVersion=0.13)
[warn]
[warn] Note: Unresolved dependencies path:
[warn] me.my.app:sbt-plugin:0.1.0 (scalaVersion=2.10, sbtVersion=0.13) (/home/me/Projects/app/app-web/project/plugins.sbt#L7-8)
[warn] +- default:app-web-build:0.1-SNAPSHOT (scalaVersion=2.10, sbtVersion=0.13)
sbt.ResolveException: unresolved dependency: me.my.app#sbt-plugin;0.1.0: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:313)
[error] (*:update) sbt.ResolveException: unresolved dependency: me.my.app#sbt-plugin;0.1.0: not found
As you can see the URL used to download the plugin is not the same as the
one where the plugin has been published. (with publishLocal my plugin is
published under the same path but resolved successfully.
Local : me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/jars/sbt-plugin.jar
Upload : me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/jars/sbt-plugin.jar
Downlad: me/my/app/sbt-plugin_2.10_0.13/0.1.0/sbt-plugin-0.1.0.pom
I have tried with or without publishMavenStyle := false and with Resolver.bintrayRepo and Resolver.bintrayIvyRepo but without success.
I will be missing something but I have to admit that I feel a bit lost. So what are the missing configuration that should align the upload and download paths ?
Details :
publishMavenStyle := false -> me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/jars/sbt-plugin.jar
publishMavenStyle := true -> me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/jars/sbt-plugin.jar
Resolver.bintrayRepo -> me/my/app/sbt-plugin_2.10_0.13/0.1.0/sbt-plugin-0.1.0.pom
Resolver.bintrayIvyRepo -> me.my.app/sbt-plugin/scala_2.10/sbt_0.13/0.1.0/ivys/ivy.xml
The publication part was ok. The only problem was on the resolution side.
I had to add a custom resolver with explicit ivyStylePatterns resolver into my-project\build.sbt:
resolvers += Resolver.url("me # bintray", url("https://dl.bintray.com/{my-bintray-account}/{my-bintray-generic-repo}"))(Resolver.ivyStylePatterns)

How to keep library dependencies updated to Scala version?

I am compiling my project with sbt and am getting an UNRESOLVED DEPENDENCIES error.
The fact is that I fetched the example I use (a hello world program) from an online blog, that uses scalaVersion := "2.10.0" as shown below. I am using 2.11.2.
How do I update the library dependencies (in the build.sbt) to the latest version of Scala, specifically the revision part?
build.sbt
name := "Hello Test #1"
version := "1.0"
scalaVersion := "2.10.0"
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies += "com.typesafe.akka" % "akka-actor_2.10" % "2.2-M1"
The error:
[info] Resolving com.typesafe.akka#akka-actor_2.11.2;2.2-M1 ...
[warn] module not found: com.typesafe.akka#akka-actor_2.11.2;2.2-M1
[warn] ==== local: tried
[warn] /home/plard/.ivy2/local/com.typesafe.akka/akka-actor_2.11.2/2.2-M1/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/com/typesafe/akka/akka-actor_2.11.2/2.2-M1/akka-actor_2.11.2-2.2-M1.pom
[warn] ==== Typesafe Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/com/typesafe/akka/akka-actor_2.11.2/2.2-M1/akka-actor_2.11.2-2.2-M1.pom
[info] Resolving jline#jline;2.12 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.akka#akka-actor_2.11.2;2.2-M1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe.akka#akka-actor_2.11.2;2.2-M1: not found
[error] Total time: 1 s, completed Aug 11, 2014 10:32:11 AM
name := "Hello Test #1"
version := "1.0"
scalaVersion := "2.11.2"
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.4"
This should do it. Note the %% and no version specified for the Akka artifact. Doing so, SBT will automatically append your Scala version to the artifact. See docs for more details.

Why can't SBT find the Play 2.1 plugin?

In my plugins.sbt file, I have
scalaVersion := "2.10.0"
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
addSbtPlugin("play" % "sbt-plugin" % "2.1")
When I try run sbt I get, among other things
[warn] ==== Typesafe repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/play/sbt-plugin_2.10_0.12/2.1/sbt- plugin-2.1.pom
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/play/sbt-plugin_2.10_0.12/2.1/sbt-plugin-2.1.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: play#sbt-plugin;2.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] play:sbt-plugin:2.1 (sbtVersion=0.12, scalaVersion=2.10)
[warn]
sbt.ResolveException: unresolved dependency: play#sbt-plugin;2.1: not found
Why can't SBT find the plugin? I've also tried addSbtPlugin("play" % "sbt-plugin" % "2.1-RC1") with similar results.
The problem was including the scalaVersion setting inside the plugins.sbt file. This causes sbt to search for sbt-plugin_2.10.0_0.12 in the repositories when it should actually search for sbt-plugin_2.9.2_0.12.
I'm not sure about the semantics behind specifying the scalaVersion in the plugins.sbt file, but maybe it's declaring the Scala version that SBT is running on.
Here is a link to the Play 2.1 sbt-plugin files: http://repo.typesafe.com/typesafe/simple/ivy-releases/play/sbt-plugin/scala_2.9.2/sbt_0.12/2.1-RC1/srcs/
As per the documentation,
Add this in your project/plugins.sbt:
addSbtPlugin("play" % "sbt-plugin" % "2.1.0")
Change the project/build.properties
sbt.version=0.12.2

How to define new resolvers?

I have defined several additional resolvers, which are displayed by resolvers:
[clearspan]> show resolvers
[info] List(bt: http://maven.[redacted].com/artifactory/repo/, Local Maven Repository: file:///home/dan/.m2/repository, Oracle: http://download.java.net/maven/2, localMaven: file:///home/dan/.m2/repository)
However, when I run update, it only tries Maven Central. Any idea why?
> update
[info] Updating {file:/home/dan/l/clearspan/}cs-trading-processor...
[warn] [NOT FOUND ] javax.resource#connector;1.0!connector.jar (44ms)
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/javax/resource/connector/1.0/connector-1.0.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: FAILED DOWNLOADS ::
[warn] :: ^ see resolution messages for details ^ ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: javax.resource#connector;1.0!connector.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[info]
[warn] :: problems summary ::
[warn] :::: WARNINGS
[warn] [NOT FOUND ] javax.resource#connector;1.0!connector.jar (44ms)
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/javax/resource/connector/1.0/connector-1.0.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: FAILED DOWNLOADS ::
[warn] :: ^ see resolution messages for details ^ ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: javax.resource#connector;1.0!connector.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[info]
[info] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
[error] {file:/home/dan/l/[redacted]/}[redacted]/*:update: sbt.ResolveException: download failed: javax.resource#connector;1.0!connector.jar
[error] Total time: 2 s, completed Sep 7, 2011 4:51:11 PM
According to the documentation Library dependencies section Resolvers:
Not all packages live on the same server; sbt uses the standard Maven2
repository by default. If your dependency isn’t on one of the default
repositories, you’ll have to add a resolver to help Ivy find it.
You can do it using resolvers setting:
resolvers += name at location
You did it and it didn't work.
In Overriding default resolvers you can read:
resolvers does not contain the default resolvers; only additional ones
added by your build definition.
sbt combines resolvers with some default repositories to form
externalResolvers.
Therefore, to change or remove the default resolvers, you would need
to override externalResolvers instead of resolvers.
In your answer you said using externalResolvers helped, but I doubt that (sorry).
I think the issue was where you defined the new resolvers. It appears that the resolvers come from the top-level project while you may have been using multi-project build and the resolvers setting didn't get picked up.
I think a solution is to define the resolvers setting for the build in general using in ThisBuild or in [projectName] for a given project with projectName replaced with the proper project name the value of the setting should be set to.
I should have been setting externalResolvers instead.

Resources