无法将sbt项目部署到Heroku

时间:2019-05-10 17:21:00

标签: git scala heroku sbt

我有一个基于sbt的项目https://github.com/hhimanshu/sbt101/tree/m5(分支为m5)。

我在计算机上本地安装了heroku工具带,并运行了以下命令:

594  heroku login
595  heroku run sbt console
596  heroku run sbt console --app h2-sbt101
597  heroku git:remote -a h2-sbt101

我跑步时

git push heroku master

它失败并出现以下错误:

remote:        [info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.8/scala-library-2.12.8.jar ...
remote:        [info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.12.8/scala-compiler-2.12.8.jar ...
remote:        [info] downloading https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.12.8/scala-reflect-2.12.8.jar ...
remote:        [info]   [SUCCESSFUL ] org.scala-lang#scala-reflect;2.12.8!scala-reflect.jar (577ms)
remote:        [info]   [SUCCESSFUL ] org.scala-lang#scala-library;2.12.8!scala-library.jar (696ms)
remote:        [info]   [SUCCESSFUL ] org.scala-lang#scala-compiler;2.12.8!scala-compiler.jar (915ms)
remote:        [info] Done updating.
remote:        [info] Done updating.
remote:        [info] Compiling 1 Scala source to /tmp/scala_buildpack_build_dir/calculators/target/scala-2.12/classes ...
remote:        [warn] there was one deprecation warning (since 2.11.0); re-run with -deprecation for details
remote:        [warn] one warning found
remote:        [info] Done compiling.
remote:        [success] Total time: 2 s, completed May 10, 2019 5:17:20 PM
remote:        [error] Not a valid command: stage (similar: last-grep, set, last)
remote:        [error] Not a valid project ID: stage
remote:        [error] Expected ':'
remote:        [error] Not a valid key: stage (similar: state, target, tags)
remote:        [error] stage
remote:        [error]      ^
remote:
remote:  !     ERROR: Failed to run sbt!
remote:        It looks like your build.sbt does not have a valid 'stage' task.
remote:        Please read our Dev Center article for information on how to create one:
remote:        https://devcenter.heroku.com/articles/scala-support#build-behavior
remote:        If you continue to have problems, please submit a ticket so we can help:
remote:        http://help.heroku.com
remote:
remote:        Thanks,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Scala app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !   Push rejected to h2-sbt101.
remote:
To https://git.heroku.com/h2-sbt101.git
 ! [remote rejected] master -> master (pre-receive hook declined)

我在这里想念什么?

1 个答案:

答案 0 :(得分:3)

git push heroku master

告诉Git推送您本地的master分支,但是您说您的代码在m5分支中。您可以告诉Git将本地m5推送到Heroku的master(它唯一的构建分支),如下所示:

git push heroku m5:master