我试图在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'
我到处寻找解决方案,我发现了一些对其他人有用的东西,但在这种情况下没有用。我试过以下方法:
将行
project/play-fork-run.sbt
添加到.gitignore
文件。删除文件
play-fork-run.sbt
。将这些解析器添加到
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/"
但似乎什么也没用,当我在本地主机上编译和运行应用程序时,它工作得很好。
有什么办法解决这个问题吗?
任何帮助都是非常感谢的!
谢谢
最佳答案
这在localhost上工作的原因是,您可能在某个时刻运行了activator
,这会将有问题的依赖项下载到您的本地.ivy2
缓存。但在heorku上,只运行了sbt
,而且activator中存在一个长期未修复的主要错误,导致activator和sbt之间的解析器不同。
听起来你已经看到了这些报告,其中包含一些建议(主要是你已经尝试过的):
https://github.com/typesafehub/activator/issues/979
https://github.com/typesafehub/activator/issues/1058
https://github.com/typesafehub/activator/issues/1057
https://github.com/typesafehub/activator/issues/1036
根本的问题是依赖于:
addSbtPlugin("com.typesafe.play" % "sbt-fork-run-plugin" % "2.4.3")
仔细检查
project/
下的所有sbt文件,确保这些文件中没有此依赖项。另外,在推送到heroku之前,还要确保git存储库的更改已经提交。最后,如果您仍然处于困境,可以切换到使用sbt-heroku plugin,它使用本地编译的资产并将它们部署到heroku。这样可以避免所有的问题。
另外,我建议您在Play mailing list上提起这个。这是一个长期存在的问题,我见过很多人遇到过。TypeSafe的人需要从他们的用户那里得知这是多么的猖獗。