我有一个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中才能使我的项目正常工作?
/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
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")