gpt4 book ai didi

java - 如何在 Heroku 上部署 java gradle 应用程序

转载 作者:行者123 更新时间:2023-11-30 02:51:28 25 4
gpt4 key购买 nike

请帮助在 Heroku 上部署我的应用程序。从 Heroku 获取错误消息 *

"Application Error. An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details."

这里是来自 Heroku 的日志:

2016-07-21T22:11:30.966800+00:00 heroku[slug-compiler]: Slug compilation 
started 2016-07-21T22:11:30.773385+00:00 heroku[api]: Release v8 created by
zzheads@gmail.com 2016-07-21T22:11:56.184847+00:00 heroku[router]: at=error
code=H14 desc="No web processes running" method=GET path="/favicon.ico"
host=zzheads-countries.herokuapp.com request_id=a03c9276-b038-4f9f-8e6d-
5f29f14b441 fwd="5.3.141.153" dyno= connect= service= status=503 bytes=

我的 gradle 构建文件:

group 'com.zzheads'
version '1.0-SNAPSHOT'

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.3.6.RELEASE'
}
}

apply plugin: 'java'
apply plugin: 'spring-boot'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
}

task stage {
dependsOn build
}

还有我的 Proc 文件:

web: java -Dserver.port=$PORT $JAVA_OPTS -jar target/countries-1.0-SNAPSHOT.jar

最佳答案

您的构建可能会在目录 build/libs 中生成一个可执行 JAR 文件。在您的 Procfile 中尝试一下:

web: java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/countries-1.0-SNAPSHOT.jar

您可以通过运行以下命令在本地测试它:

$ ./gradlew stage
$ heroku local

关于java - 如何在 Heroku 上部署 java gradle 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38515588/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com