Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sbt cannot find the scripted-sbt dependency

Tags:

sbt

I'm using the scripted sbt plugin for one of my projects and it has been working fine, but stopped working sometime recently for no obvious reason. Here is a sample setup that fails:

# project/plugins.sbt
libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value

# build.sbt
scalaVersion := "2.11.6"

scriptedSettings

# project/build.properties
sbt.version=0.13.5

When I do sbt update I see the following. Note that it downloads scripted-plugin but cannot find scripted-sbt. This worked fine until recently and just kind of stopped. Any ideas?

test$ sbt update
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0
[info] Loading project definition from /private/tmp/test/project
[info] Updating {file:/private/tmp/test/project/}test-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...

...

[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/scripted-plugin/0.13.5/jars/scripted-plugin.jar ...
[info]  [SUCCESSFUL ] org.scala-sbt#scripted-plugin;0.13.5!scripted-plugin.jar (4424ms)

...

[info] Done updating.
[info] Set current project to test (in build file:/private/tmp/test/)
[info] Updating {file:/private/tmp/test/}test...
[info] Resolving org.scala-sbt#scripted-sbt;0.13.5 ...
[warn]  module not found: org.scala-sbt#scripted-sbt;0.13.5
[warn] ==== local: tried
[warn]   /Users/rnorris/.ivy2/local/org.scala-sbt/scripted-sbt/0.13.5/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/org/scala-sbt/scripted-sbt/0.13.5/scripted-sbt-0.13.5.pom
[info] Resolving org.scala-sbt#sbt-launch;0.13.5 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.scala-sbt#scripted-sbt;0.13.5: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: org.scala-sbt#scripted-sbt;0.13.5: not found
  at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:217)
  at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:126)

...

[error] (*:update) sbt.ResolveException: unresolved dependency: org.scala-sbt#scripted-sbt;0.13.5: not found
[error] Total time: 2 s, completed Jun 12, 2015 2:13:32 PM
like image 510
tpolecat Avatar asked Jun 16 '15 04:06

tpolecat


People also ask

Which is the correct way to add dependencies in sbt file?

Library dependencies can be added in two ways: unmanaged dependencies are jars dropped into the lib directory. managed dependencies are configured in the build definition and downloaded automatically from repositories.

How does sbt resolve dependencies?

Background. update resolves dependencies according to the settings in a build file, such as libraryDependencies and resolvers . Other tasks use the output of update (an UpdateReport ) to form various classpaths. Tasks that in turn use these classpaths, such as compile or run , thus indirectly depend on update .

What is Ivy in sbt?

Apache Ivy is a transitive package manager. It is a sub-project of the Apache Ant project, with which Ivy works to resolve project dependencies. An external XML file defines project dependencies and lists the resources necessary to build a project.


1 Answers

It looks like the scripted plugin is only found in the sbt-plugins repository. Which seems to only be added if sbtPlugin is set to true.

Making the following change to your example gives me a resolution:

#build.sbt 
sbtPlugin := true

scalaVersion := "2.11.6"

scriptedSettings

With the following output:

sbt update
[info] Loading project definition from /root/test/project
[info] Set current project to test (in build file:/root/test/)
[info] Updating {file:/root/test/}test...
[info] Resolving org.scala-sbt#sbt-launch;0.13.5 ...
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/scripted-sbt/0.13.5/jars/scripted-sbt.jar ...
[info]  [SUCCESSFUL ] org.scala-sbt#scripted-sbt;0.13.5!scripted-sbt.jar (1323ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/scripted-framework/0.13.5/jars/scripted-framework.jar ...
[info]  [SUCCESSFUL ] org.scala-sbt#scripted-framework;0.13.5!scripted-framework.jar (1365ms)
[info] downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.5/jars/sbt-launch.jar ...
[info]  [SUCCESSFUL ] org.scala-sbt#sbt-launch;0.13.5!sbt-launch.jar (2722ms)
[info] Done updating.
[success] Total time: 11 s, completed Jun 16, 2015 5:45:39 AM

Note, I also tried this with sbt 0.13.8 and had the exact same issue and same results.

EDIT: If setting sbtPlugin := true doesn't make sense for this particular application, you can add resolvers += Resolver.typesafeIvyRepo("releases") to the main build.sbt to achieve the same results.

EDIT2: This may also be an issue: resolvers not shared to dependent sbt projects?

like image 161
Lykathia Avatar answered Jan 04 '23 00:01

Lykathia