Scala / SBT - dependency not allowed on PaaS (cloudControl & heroku)

I have a simple application Scala

built with spray.io . I am using Scala 2.11.2

and SBT 0.13.0

. All my dependencies are listed here:

libraryDependencies ++= Seq(
  "com.typesafe.akka"  %% "akka-actor"          % "2.3.6",
  "com.typesafe.akka"  %% "akka-slf4j"          % "2.3.6",
  "io.spray"            % "spray-can_2.11"      % "1.3.2",
  "io.spray"            % "spray-routing_2.11"  % "1.3.2",
  "io.spray"            % "spray-json_2.11"     % "1.3.1"
)

libraryDependencies += "org.mongodb" %% "casbah" % "2.7.2"

libraryDependencies += "com.stormpath.sdk" % "stormpath-sdk-api" % "1.0.RC4.2"

libraryDependencies += "com.stormpath.sdk" % "stormpath-sdk-httpclient" % "1.0.RC4.2"

      

When building and running locally everything is fine, but when I try to push / deploy it on platforms PaaS

like cloudControl or heroku I get below dependency problem:

   [info] Resolving org.apache.httpcomponents#httpclient;${httpclient.version} ...
   [warn]   module not found: org.apache.httpcomponents#httpclient;${httpclient.version}
   [warn] ==== local: tried
   [warn]   /tmp/scala_buildpack_build_dir/.sbt_home/.ivy2/local/org.apache.httpcomponents/httpclient/${httpclient.version}/ivys/ivy.xml
   [warn] ==== public: tried
   [warn]   http://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/${httpclient.version}/httpclient-${httpclient.version}.pom
   [warn] ==== spray repo: tried
   [warn]   http://repo.spray.io/org/apache/httpcomponents/httpclient/${httpclient.version}/httpclient-${httpclient.version}.pom
   [warn] ==== spray nightlies: tried
   [warn]   http://nightlies.spray.io/org/apache/httpcomponents/httpclient/${httpclient.version}/httpclient-${httpclient.version}.pom
   [warn] ==== public: tried
   [warn]   http://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/${httpclient.version}/httpclient-${httpclient.version}.pom

      

...

   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
   [warn]   ::          UNRESOLVED DEPENDENCIES         ::
   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
   [warn]   :: org.apache.httpcomponents#httpclient;${httpclient.version}: not found
   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
   [warn]   ::              FAILED DOWNLOADS            ::
   [warn]   :: ^ see resolution messages for details  ^ ::
   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
   [warn]   :: com.stormpath.sdk#stormpath-sdk-api;1.0.RC4.2!stormpath-sdk-api.jar
   [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
   sbt.ResolveException: unresolved dependency: org.apache.httpcomponents#httpclient;${httpclient.version}: not found

      

...

   [error] (*:update) sbt.ResolveException: unresolved dependency: org.apache.httpcomponents#httpclient;${httpclient.version}: not found
   [error] download failed: com.stormpath.sdk#stormpath-sdk-api;1.0.RC4.2!stormpath-sdk-api.jar
   [error] Total time: 59 s, completed May 4, 2015 1:05:37 PM

      

Checking my dependencies with sbt-dependency-graph shows that not resolved org.apache.httpcomponents:httpclient

is a nested dependency com.stormpath.sdk:stormpath-sdk-httpclient:1.0.RC4.2

.

The variable is ${httpclient.version}

not resolved at build time for some reason , but that's all I can figure out here. Please, help!!!

+3


source to share


1 answer


I'm not sure what's going on. But eliminating the transitive dependency and adding it to SBT explicitly seems to fix the problem, at least the unresolved dependency issue:

libraryDependencies += "com.stormpath.sdk" % "stormpath-sdk-httpclient" % "1.0.RC4.2" exclude("org.apache.httpcomponents","httpclient")

libraryDependencies += "org.apache.httpcomponents" % "httpclient" % "4.2.2"

      

But keep in mind that we don't know which version of apache httpclient is stormpath-sdk-httpclient

used in compiling it, so you can run runtime related paths / bindings of bound exceptions. If this happens, I recommend asking the developers stormpath-sdk-httpclient

.



EDIT:

you can see the version they were used in: https://github.com/stormpath/stormpath-sdk-java/blob/master/pom.xml#L98

+5


source







All Articles