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

mko*_*zun 3 scala heroku sbt cloudcontrol stormpath

我有一个Scala使用spray.io构建的简单应用程序.我正在使用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"
Run Code Online (Sandbox Code Playgroud)

虽然在本地构建和运行它一切都很好但是当我尝试将其推送/部署到PaaScloudControlheroku这样的平台时,我遇到了依赖性问题:

   [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
Run Code Online (Sandbox Code Playgroud)

...

   [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
Run Code Online (Sandbox Code Playgroud)

...

   [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
Run Code Online (Sandbox Code Playgroud)

使用sbt-dependency-graph检查我的依赖关系向我展示了未解析org.apache.httpcomponents:httpclient的嵌套依赖关系com.stormpath.sdk:stormpath-sdk-httpclient:1.0.RC4.2.

由于某些原因,变量${httpclient.version}在构建期间没有得到解决 - 但这就是我能在这里解决的全部内容.请帮忙!!!

ped*_*rla 5

我不确定发生了什么.但是排除传递依赖并将其明确地添加到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"
Run Code Online (Sandbox Code Playgroud)

但请记住,我们并不真正知道apache的httpclient stormpath-sdk-httpclient在其编译中使用的版本,因此您可能会遇到运行时类路径/链接相关的异常.如果发生这种情况,我建议询问开发人员stormpath-sdk-httpclient.

编辑:

你可以看到他们使用的版本:https: //github.com/stormpath/stormpath-sdk-java/blob/master/pom.xml#L98