This is a refinement of a previous question with closer attribution to the problem.
I'm trying to confirm I can run my SBT project offline. I can, unless logback is one of my libraryDependencies. Why is logback triggering a problem? I've made a simple example consisting of just a build.sbt and a 'hello world' app...
build.sbt with a bunch of random dependencies to prove the point:
name := "testProject"
version := "0.0.1"
scalaVersion := "2.10.3"
libraryDependencies ++= Seq(
"org.apache.commons" % "commons-math3" % "3.2",
"com.amazonaws" % "aws-java-sdk" % "1.4.0.1",
"ch.qos.logback" % "logback-classic" % "1.1.1",
"com.typesafe.akka" %% "akka-actor" % "2.3.1",
"com.typesafe.akka" %% "akka-remote" % "2.3.1",
"org.scalaz" %% "scalaz-core" % "7.0.3"
)
My steps
- Delete
~/.ivy2
,~/.sbt
, andtarget/
inside my project, just to be sure - Ensure connected to the internet, and do
sbt run
. My hello world runs successfully - Disconnect from internet
sbt clean
sbt run
. Build fails with logback as an unresolved dependency- Remove the logback dependency and
sbt run
again. Hello world runs.
This is the error from step 5:
[info] Resolving ch.qos.logback#logback-classic;1.1.1 ...
[warn] Host repo1.maven.org not found. url=http://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.pom
[info] You probably access the destination server through a proxy server that is not well configured.
[warn] module not found: ch.qos.logback#logback-classic;1.1.1
[warn] ==== local: tried
[warn] /home/user/.ivy2/local/ch.qos.logback/logback-classic/1.1.1/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: ch.qos.logback#logback-classic;1.1.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: ch.qos.logback#logback-classic;1.1.1: not found
Update:
Using the last
command in SBT there is a lot of debug info for dependency resolution. Here's an example of Akka resolving successfully:
[info] Resolving com.typesafe.akka#akka-actor_2.10;2.3.1 ...
[debug] sbt-chain: Checking cache for: dependency: com.typesafe.akka#akka-actor_2.10;2.3.1 {compile=[default(compile)]}
[debug] sbt-chain: module revision found in cache: com.typesafe.akka#akka-actor_2.10;2.3.1
[debug] local: revision in cache: com.typesafe.akka#akka-actor_2.10;2.3.1
[debug] found com.typesafe.akka#akka-actor_2.10;2.3.1 in sbt-chain
[debug] == resolving dependencies testproject#testproject_2.10;0.0.1->com.typesafe.akka#akka-actor_2.10;2.3.1 [compile->runtime]
[debug] == resolving dependencies testproject#testproject_2.10;0.0.1->com.typesafe.akka#akka-actor_2.10;2.3.1 [compile->compile]
[debug] == resolving dependencies com.typesafe.akka#akka-actor_2.10;2.3.1->org.scala-lang#scala-library;2.10.3 [compile->master(*)]
[debug] == resolving dependencies com.typesafe.akka#akka-actor_2.10;2.3.1->org.scala-lang#scala-library;2.10.3 [compile->compile(*)]
[debug] == resolving dependencies com.typesafe.akka#akka-actor_2.10;2.3.1->com.typesafe#config;1.2.0 [compile->master(*)]
Here's the failure for Logback:
[info] Resolving ch.qos.logback#logback-classic;1.1.1 ...
[debug] sbt-chain: Checking cache for: dependency: ch.qos.logback#logback-classic;1.1.1 {compile=[default(compile)]}
[debug] tried /home/user/.ivy2/local/ch.qos.logback/logback-classic/1.1.1/ivys/ivy.xml
[debug] local: no ivy file found for ch.qos.logback#logback-classic;1.1.1
[debug] tried http://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.pom
[warn] Host repo1.maven.org not found. url=http://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.pom
[info] You probably access the destination server through a proxy server that is not well configured.
[debug] public: no ivy file found for ch.qos.logback#logback-classic;1.1.1
[warn] module not found: ch.qos.logback#logback-classic;1.1.1
[warn] ==== local: tried
[warn] /home/user/.ivy2/local/ch.qos.logback/logback-classic/1.1.1/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.pom
I can confirm the following files in the cache (not the '~/.ivy/local' folder):
~/.ivy2/cache/ch.qos.logback/logback-classic$ ls
ivy-1.1.1.xml ivy-1.1.1.xml.original ivydata-1.1.1.properties jars