【问题标题】:Deploy Spring Boot with Gradle (Kotlin) application - the jar is not found使用 Gradle (Kotlin) 应用程序部署 Spring Boot - 找不到 jar
【发布时间】:2018-09-12 04:32:40
【问题描述】:

我有一个用 Spring Boot、Kotlin、Gradle 制作的简单应用程序。我关注the official tutorial 并尝试遵循所有可能的默认值。

$ git push heroku master
Counting objects: 2, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 231 bytes | 231.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> JVM Common app detected
remote: -----> Installing JDK 1.8... done
remote: -----> Discovering process types
remote:        Procfile declares types -> (none)
remote:
remote: -----> Compressing...
remote:        Done: 50.7M
remote: -----> Launching...
remote:        Released v50
remote:        https://---.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.

奇怪的是,我得到的是“检测到 JVM 通用应用”而不是“检测到 Gradle 应用”。

我无法部署应用程序。当我做heroku logs --tail 时,我得到:

2018-04-02T23:02:39.257887+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -Dserver.port=50478 -jar build/libs/scraper-0.0.1-SNAPSHOT.jar`
2018-04-02T23:02:41.645544+00:00 heroku[web.1]: Process exited with status 1
2018-04-02T23:02:41.664910+00:00 heroku[web.1]: State changed from starting to crashed
2018-04-02T23:02:41.577966+00:00 app[web.1]: Error: Unable to access jarfile build/libs/scraper-0.0.1-SNAPSHOT.jar
2018-04-02T23:02:41.572483+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2018-04-02T23:05:10.000000+00:00 app[api]: Build started by user ---
2018-04-02T23:05:21.108667+00:00 app[api]: Release v50 created by user ---
2018-04-02T23:05:10.000000+00:00 app[api]: Build succeeded
2018-04-02T23:05:21.635834+00:00 heroku[web.1]: State changed from crashed to down
  • 使用 Spring Boot 2.0.0.RELEASE
  • 使用 Kotlin 1.2.31
  • build.gradle 中没有特殊任务
  • 没有Procfile

有没有办法使用默认值(即没有 Procfile,没有特殊的 Gradle 任务)来解决这个问题?如果无法使用默认值,我该怎么办?谢谢

【问题讨论】:

    标签: spring-boot heroku gradle kotlin


    【解决方案1】:

    您确实应该得到(至少)以下内容:

    remote: -----> Gradle app detected
    remote: -----> Spring Boot detected
    

    这是你第一次推动吗?您是否手动设置了构建包?也许尝试清除 buildpacks (heroku buildpacks:clear)。如果您可以在某处发布您的应用,这可能有助于检查问题可能是什么。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-31
      • 2020-05-08
      • 2017-06-24
      • 2017-09-30
      • 2017-03-12
      • 2017-12-21
      • 2018-07-14
      • 2021-05-18
      相关资源
      最近更新 更多