[英]Why is deploying gradle java app to heroku failing?
I am trying to deploy a gradle java app to heroku from my local machine. 我正在尝试从本地计算机将gradle Java应用程序部署到heroku。 My project contains the following files
我的项目包含以下文件
I have defined the following tasks in my build.gradle 我在build.gradle中定义了以下任务
task stage {
dependsOn build
}
task wrapper(type: Wrapper) {
gradleVersion = '2.12'
}
The content of ProcFile is as follows: ProcFile的内容如下:
web: java -Dserver.port=$PORT $JAVA_OPTS -jar target/demo-0.0.1-SNAPSHOT.jar
While executing git commit heroku master
I get the following error 执行
git commit heroku master
,出现以下错误
while executing git ls-files gradle
the following files are listed 在执行
git ls-files gradle
,列出了以下文件
Could you please suggest why I am getting the error while deploying the app to heroku server? 您能否建议为什么将应用程序部署到heroku服务器时出现错误?
If you are using gradlew, then you must also add your
gradle/wrapper/gradle-wrapper.jar
andgradle/wrapper/gradle-wrapper.properties
to your Git repository.如果使用gradlew,则还必须将
gradle/wrapper/gradle-wrapper.jar
和gradle/wrapper/gradle-wrapper.properties
到Git存储库。 If you do not add these files, you will receive an error such as:如果不添加这些文件,则会收到以下错误消息:
-----> executing ./gradlew stage Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
And to solve it: 并解决它:
You can add the wrapper files by running these commands:
您可以通过运行以下命令来添加包装器文件:
git add gradle/wrapper git commit -m "Gradle Wrapper"
From Deploying Gradle apps on Heroku . 从在Heroku上部署Gradle应用程序开始 。
You don't need this 你不需要这个
task stage{
dependsOn build}
task wrapper(type:Wrapper){
gradleVersion = '5.6.1'
}
Instead try using this: 而是尝试使用此:
task stage(dependsOn: ['clean', 'installDist'])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.