使用Gradle(Kotlin)应用程序部署Spring Boot - 找不到jar

时间:2018-04-02 23:16:44

标签: spring-boot heroku gradle kotlin

我有一个简单的应用程序在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 Common app”而不是“检测到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任务)?如果不能使用默认值,我该怎么办?感谢

1 个答案:

答案 0 :(得分:1)

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

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

这是你第一次推动吗?你手动设置了buildpack吗?也许尝试清除buildpacks(heroku buildpacks:clear)。如果您可以在某个地方发布您的应用,那么检查问题可能会有所帮助。