在Heroku上部署Play Framework 2.4时出错

时间:2015-10-24 21:35:56

标签: git heroku playframework sbt typesafe-activator

我正在尝试在Heroku上部署Play Framework(Java)应用程序(v 2.4),但是当我执行命令git push heroku master时,我得到以下异常:

remote:        [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
remote:        [warn]   ::          UNRESOLVED DEPENDENCIES         ::
remote:        [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
remote:        [warn]   :: com.typesafe.sbtrc#client-2-11;0.3.1: not found
remote:        [warn]   :: com.typesafe.sbtrc#actor-client-2-11;0.3.1: not found
remote:        [warn]   ::::::::::::::::::::::::::::::::::::::::::::::
remote:        [warn]
remote:        [warn]   Note: Unresolved dependencies path:
remote:        [warn]           com.typesafe.sbtrc:client-2-11:0.3.1
remote:        [warn]             +- com.typesafe.play:fork-run-protocol_2.11:2.4.3 ((play.sbt.forkrun.PlayForkRun) PlayForkRun.scala#L48)
remote:        [warn]             +- com.typesafe.play:fork-run_2.11:2.4.3 ((play.sbt.forkrun.PlayForkRun) PlayForkRun.scala#L48)
remote:        [warn]             +- escarbajo:escarbajo_2.11:1.0-SNAPSHOT
remote:        [warn]           com.typesafe.sbtrc:actor-client-2-11:0.3.1
remote:        [warn]             +- com.typesafe.play:fork-run_2.11:2.4.3 ((play.sbt.forkrun.PlayForkRun) PlayForkRun.scala#L48)
remote:        [warn]             +- escarbajo:escarbajo_2.11:1.0-SNAPSHOT
remote:        sbt.ResolveException: unresolved dependency: com.typesafe.sbtrc#client-2-11;0.3.1: not found
remote:        unresolved dependency: com.typesafe.sbtrc#actor-client-2-11;0.3.1: not found
remote:         at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:291)
remote:         at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:188)
remote:         at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:165)
remote:         at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
remote:         at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
remote:         at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:132)
remote:         at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
remote:         at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
remote:         at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
remote:         at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
remote:         at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
remote:         at xsbt.boot.Using$.withResource(Using.scala:10)
remote:         at xsbt.boot.Using$.apply(Using.scala:9)
remote:         at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
remote:         at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
remote:         at xsbt.boot.Locks$.apply0(Locks.scala:31)
remote:         at xsbt.boot.Locks$.apply(Locks.scala:28)
remote:         at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
remote:         at sbt.IvySbt.withIvy(Ivy.scala:127)
remote:         at sbt.IvySbt.withIvy(Ivy.scala:124)
remote:         at sbt.IvySbt$Module.withModule(Ivy.scala:155)
remote:         at sbt.IvyActions$.updateEither(IvyActions.scala:165)
remote:         at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1369)
remote:         at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1365)
remote:         at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1399)
remote:         at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1397)
remote:         at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
remote:         at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1402)
remote:         at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1396)
remote:         at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
remote:         at sbt.Classpaths$.cachedUpdate(Defaults.scala:1419)
remote:         at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1348)
remote:         at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1310)
remote:         at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
remote:         at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
remote:         at sbt.std.Transform$$anon$4.work(System.scala:63)
remote:         at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
remote:         at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
remote:         at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
remote:         at sbt.Execute.work(Execute.scala:235)
remote:         at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
remote:         at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
remote:         at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
remote:         at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
remote:         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
remote:         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
remote:         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
remote:         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
remote:         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
remote:         at java.lang.Thread.run(Thread.java:745)
remote:        [error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe.sbtrc#client-2-11;0.3.1: not found
remote:        [error] unresolved dependency: com.typesafe.sbtrc#actor-client-2-11;0.3.1: not found
remote:        [error] Total time: 20 s, completed Oct 24, 2015 9:02:27 PM
remote:
remote:  !     ERROR: Failed to run sbt!
remote:        We're sorry this build is failing. If you can't find the issue in application
remote:        code, please submit a ticket so we can help: https://help.heroku.com
remote:        You can also try reverting to the previous version of the buildpack by running:
remote:        $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-scala#previous-version
remote:
remote:        Thanks,
remote:        Heroku
remote:
remote:
remote:  !     Push rejected, failed to compile Play 2.x - Java app
remote:
remote: Verifying deploy...
remote:
remote: !       Push rejected to protected-lowlands-4290.
remote:
To https://git.heroku.com/protected-lowlands-4290.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/protected-lowlands-4290.git'

我已经搜遍了所有的解决方案,我找到了一些适用于其他人的东西,但在这种情况下却没有用。我尝试过以下方法:

  1. 将行project/play-fork-run.sbt添加到.gitignore文件。
  2. 删除文件play-fork-run.sbt
  3. 将这些解析器添加到build.stb文件中: resolvers += Resolver.url("Typesafe Ivy", url("http://repo.typesafe.com/typesafe/ivy-snapshots"))(Resolver.ivyStylePatterns) resolvers += "Typesafe" at "http://repo.typesafe.com/typesafe/releases/"
  4. 但似乎没什么用,当我在localhost上编译并运行应用程序时,它运行得很好。

    有什么想法可以解决这个问题吗?

    非常感谢任何帮助!

    由于

2 个答案:

答案 0 :(得分:2)

这适用于localhost的原因是您可能在某个时刻运行activator,这会将违规依赖项下载到本地.ivy2缓存。但是在Heorku上,只有sbt运行,并且激活器中存在主要错误,该错误很长时间没有被修复,导致激活器和sbt之间的不同解析器。

听起来你已经遇到过这些报告,其中包含一些建议(主要是你已经尝试过的):

潜在的问题是依赖于此:

addSbtPlugin("com.typesafe.play" % "sbt-fork-run-plugin" % "2.4.3")

仔细检查project/下的所有sbt文件,以确保这些依赖项不在其中任何一个。还要确保在推送到Heroku之前已经提交了Git存储库更改。

最后,如果你仍然卡住了,你可以切换到使用sbt-heroku plugin,它使用本地编译的资产并将它们部署到Heroku。这将一起避免这个问题。

另外,我建议你在Play mailing list上提出这个问题。这是一个长期存在的问题,我遇到了很多遇到它的人。 Typesafe的人们需要听取他们的用户关于这是多么猖獗的事情。

答案 1 :(得分:1)

对于Play应用,请确保以下情况属实:

  1. 删除<project root folder>/project/play-fork-run.sbt
  2. 删除<project root folder>/project/sbt-ui.sbt
  3. fork in run := true移除<project root folder>/build.sbt,除非明确地希望它在那里。
  4. 另外:确保文件play-fork-run.sbtsbt-ui.sbt位于您的.gitignore中,但尚未检入您的项目。

    如上所述,如果您继续看到问题,请删除以下行:

    addSbtPlugin("com.typesafe.play" % "sbt-fork-run-plugin" % "x.x.x")

    addSbtPlugin("org.scala-sbt" % "sbt-core-next" % "x.x.x")

    来自项目中的所有插件引用。这些插件仅支持Activator UI,并且不为常规构建提供有用的功能。