如何将缺失的SNAPSHOT依赖项添加到Heroku?

问题描述 投票:1回答:2

我有一个Scala Play 2.7.x应用程序,已部署到Heroku。但是,由于缺少依赖项"com.github.tototoshi" %% "play-joda-routes-binder" % "1.3.1-SNAPSHOT",构建失败,这是正确的,因为我是在本地构建的。如何使此缺失的依赖关系可用于Heroku?

我需要的依赖项是此https://github.com/tototoshi/play-joda-routes-binder,但是它有一个错误,我已在此将其修复为https://github.com/tototoshi/play-joda-routes-binder/pull/6。但是,该项目的作者似乎已经几个月了。我可以在本地构建PR,但是如何将其添加到Heroku中才能使我的项目正常工作?

scala github heroku playframework sbt
2个回答
1
投票
例如,您可以将已编译的jar放入项目的子文件夹中:/lib。 Sbt将自动在此目录中查找jar。如果要将其配置为其他内容,则可以定义键unmanagedBase:

unmanagedBase := baseDirectory.value / "custom_lib"

这里有关于sbt库管理的更多文档:https://www.scala-sbt.org/1.x/docs/Library-Dependencies.html

也有playframework对此进行了文档记录,但是基本上是相同的:https://www.playframework.com/documentation/2.7.1/SBTDependencies


0
投票
[另一种解决方案是不使用与Github连接的自动部署,而是使用SBT Heroku CLI,然后在本地构建/部署,并像这样简单地将二进制工件上传到Heroku:

sbt stage deployHeroku heroku open --app myapp

将以下两个条目添加到project/plugins.sbt文件中(截止到今天的最新版本):

addSbtPlugin("com.heroku" % "sbt-heroku" % "2.1.2") addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.4.1")

© www.soinside.com 2019 - 2024. All rights reserved.