gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 10:21:46 24 4
gpt4 key购买 nike

我有一个使用 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"

虽然在本地构建和运行它一切都很好,但是当我尝试将它推送/部署到 PaaS 平台(如 cloudControl)时或 heroku我遇到了依赖性问题:

   [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 似乎可以解决问题,至少是 Unresolved 依赖问题:

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,因此您可能会遇到运行时类路径/链接相关的异常。如果发生这种情况,我建议询问 stormpath-sdk-httpclient 的开发人员。

编辑:

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

关于Scala/SBT - 在 PaaS(cloudControl 和 heroku)上没有解决依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30031536/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com