繁体   English   中英

将应用程序部署到 heroku(弹簧启动)时出错

[英]Error in deploying app to heroku (spring boot)

所以我要做的是将我的 Spring 引导应用程序部署到 Heroku (使用 Git 和 Z1A79ZFCLI9928)。

但是每次我将我的仓库推送到 Heroku 时,在我的终端中使用“$git push heroku master”之后就会出现这些错误。

    remote:        [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.6.2:repackage (repackage) on project UserEditor: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.6.2:repackage failed: Unable to find main class -> [Help 1]
remote:        [ERROR] 
remote:        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote:        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote:        [ERROR] 
remote:        [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote:        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
remote: 
remote:  !     ERROR: Failed to build app with Maven
remote:        We're sorry this build is failing! If you can't find the issue in application code,
remote:        please submit a ticket so we can help: https://help.heroku.com/
remote: 
remote:  !     Push rejected, failed to compile Java app.
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 33efb1c07b67aebd548c83b47099d3a66a2efed2
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 33efb1c07b67aebd548c83b47099d3a66a2efed2
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to myhome-app-1.
remote: 
To https://git.heroku.com/myhome-app-1.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/myhome-app-1.git' ```

错误可能是因为您使用的是 Java 版本高于 8 并且免费部署 Heroku 仅允许 Java 版本 8。 所以在 pom.xml 中将 java 版本更改为 8 并重建 maven。 之后,在您的本地系统中运行项目只是为了验证没有错误,因为 Java-8 不包含您将在项目中使用的所有功能。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM