java - Heroku - git push/deployment 期间出错,此代码的相同版本已经构建

标签 java git github heroku heroku-cli

我在将 springboot 应用程序部署到 Heroku 时遇到问题。运行后git push heroku master ,我遇到以下错误:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.350 s
[INFO] Finished at: 2020-12-22T06:33:14Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project audit: Fatal error compiling: invalid target release: 11 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :audit
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:             31199a7acec03a3cb614ebaaf6c7720cee6684bd
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 31199a7acec03a3cb614ebaaf6c7720cee6684bd
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 tesda8app.
我不知道为什么会发生这个错误。我有两个远程存储库,用于推送代码,一个来自 Heroku,另一个来自 Github。我根据这个问题的答案尝试了以下命令,Heroku: If you are developing on a branch and deploying via git you must run:
git push heroku master:main
但错误仍然存​​在。我可以在 Heroku CLI 上尝试任何命令来解决这个问题吗?

最佳答案

经过几次尝试,我想问题的原因可能是 中断 git push heroku master命令,然后通过重新执行相同的命令继续执行,导致以下错误:

remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built:             31199a7acec03a3cb614ebaaf6c7720cee6684bd
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 31199a7acec03a3cb614ebaaf6c7720cee6684bd
remote:  ! at least twice. One common cause of this behavior is attempting to deploy         code     from a different branch.
remote:  !
所以我所做的是,我推送了另一个提交,然后重试了相同的命令 git push heroku master ,从而成功部署。
另外,请大喊 RainXCat's answer and insights ,现在我知道 Heroku 不允许在同一目录/文件夹中存在两个 git 存储库。

关于java - Heroku - git push/deployment 期间出错,此代码的相同版本已经构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65404309/

相关文章:

java - Swing 组件未移动到 GridBagLayout 中所需的单元格

java - HTTP 状态 500 - servlet appServlet 的 Servlet.init() 在 spring MVC 中抛出异常

java - MainActivity 应在启动画面期间加载

java - 用 Java 创建动态搜索框/表格

git - Netlify 无需我们团队中任何人的任何操作即可触发构建。为什么?

git - 具有共享代码库的多个产品的版本控制和发布管理

git - Heroku 推送失败

git - git 项目中手动重命名文件的修复方法是什么?

curl - 将 Org 中的 GitHub 团队添加到 REPO

unity-game-engine - Unity 2019 - 如何修复 TextMeshPro 2.0 错误 cs0433