Scala / SBT - 在 PaaS(cloudControl 和 heroku)上没有解决依赖关系

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

我有一个使用 spray.io 构建的简单 Scala 应用程序。我正在使用 Scala 2.11.2SBT 0.13.0。我所有的依赖项都列在这里:

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"

在本地构建和 运行 时一切正常,但是当我尝试将其推送/部署到 cloudControl or herokuPaaS 平台时,我遇到了以下依赖性问题:

   [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

使用 sbt-dependency-graph 检查我的依赖项表明未解析 org.apache.httpcomponents:httpclientcom.stormpath.sdk:stormpath-sdk-httpclient:1.0.RC4.2 的嵌套依赖项。

出于某种原因,变量 ${httpclient.version} 在构建过程中未被解析 - 但我在这里只能解决这个问题。请帮忙!!!

我不确定发生了什么。但是排除传递依赖并将其显式添加到 SBT 似乎可以解决问题,至少是未解决的依赖问题:

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

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

但请记住,我们并不真正知道在其编译中使用了哪个版本的 apache 的 httpclient stormpath-sdk-httpclient,因此您可能 运行 进入 运行time classpath/linking 相关异常。如果发生这种情况,我建议询问 stormpath-sdk-httpclient.

的开发人员

编辑:

您可以在以下位置查看他们使用的版本: https://github.com/stormpath/stormpath-sdk-java/blob/master/pom.xml#L98