[英]I getting an error while i am trying to update an user and not able to show my users roles using SpringBoot
[英]I am trying automatic deploy to Heroku using GitHub actions for java Gradle app (SpringBoot) but getting error every time
收到此错误:错误:命令失败:git push heroku main:refs/heads/main --force
GitHub 操作的 .yml 文件
name: Java CI
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Build with Gradle
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
with:
arguments: build
- uses: akhileshns/heroku-deploy@v3.12.12 # This is the action
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: "all-books-store" #Must be unique in Heroku
heroku_email: "mail-id-here"
branch: "main"
起初 GitHub 分支设置为 master。 我认为它可能存在问题,因此将其重命名为 main 并更改了分支。 但问题还是一样。 在部署之前,在 GitHub 操作构建中一切正常,但在构建过程中它被拒绝并显示错误。
档案
web: java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/demo-0.0.1-SNAPSHOT.jar
代码在使用 github 操作进行部署时运行
Run akhileshns/heroku-deploy@v3.12.12
Created and wrote to ~/.netrc
Successfully logged into heroku
› Warning: Our terms of service have changed:
Added git remote heroku
› https://dashboard.heroku.com/terms-of-service
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Gradle app detected
remote: -----> Spring Boot detected
remote: -----> Installing OpenJDK 1.8... done
remote: -----> Building Gradle app...
remote: -----> executing ./gradlew build -x check
remote: Downloading https://services.gradle.org/distributions/gradle-7.4.1-bin.zip
remote: ...........10%...........20%...........30%...........40%...........50%...........60%...........70%...........80%...........90%...........100%
remote: To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.4.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
remote: Daemon will be stopped at the end of the build
remote: > Task :compileJava FAILED
remote:
remote: FAILURE: Build failed with an exception.
remote:
remote: * What went wrong:
remote: Execution failed for task ':compileJava'.
remote: > invalid source release: 17
remote:
remote: * Try:
remote: > Run with --stacktrace option to get the stack trace.
remote: > Run with --info or --debug option to get more log output.
remote: > Run with --scan to get full insights.
remote:
remote: * Get more help at https://help.gradle.org
remote:
remote: BUILD FAILED in 24s
remote: 1 actionable task: 1 executed
remote:
remote: ! ERROR: Failed to run Gradle!
remote: We're sorry this build is failing. If you can't find the issue in application
remote: code, please submit a ticket so we can help: https://help.heroku.com
remote: You can also try reverting to the previous version of the buildpack by running:
remote: $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-gradle#previous-version
remote:
remote: Thanks,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Gradle app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to all-books-store.
remote:
To https://git.heroku.com/all-books-store.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/all-books-store.git'
Unable to push branch because the branch is behind the deployed branch. Using --force to deploy branch.
(If you want to avoid this, set dontuseforce to 1 in with: of .github/workflows/action.yml.
Specifically, the error was: Error: Command failed: git push heroku main:refs/heads/main
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Gradle app detected
remote: -----> Spring Boot detected
remote: -----> Installing OpenJDK 1.8... done
remote: -----> Building Gradle app...
remote: -----> executing ./gradlew build -x check
remote: Downloading https://services.gradle.org/distributions/gradle-7.4.1-bin.zip
remote: ...........10%...........20%...........30%...........40%...........50%...........60%...........70%...........80%...........90%...........100%
remote: To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.4.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
remote: Daemon will be stopped at the end of the build
remote: > Task :compileJava FAILED
remote:
remote: FAILURE: Build failed with an exception.
remote:
remote: * What went wrong:
remote: Execution failed for task ':compileJava'.
remote: > invalid source release: 17
remote:
remote: * Try:
remote: > Run with --stacktrace option to get the stack trace.
remote: > Run with --info or --debug option to get more log output.
remote: > Run with --scan to get full insights.
remote:
remote: * Get more help at https://help.gradle.org
remote:
remote: BUILD FAILED in 24s
remote: 1 actionable task: 1 executed
remote:
remote: ! ERROR: Failed to run Gradle!
remote: We're sorry this build is failing. If you can't find the issue in application
remote: code, please submit a ticket so we can help: https://help.heroku.com
remote: You can also try reverting to the previous version of the buildpack by running:
remote: $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-gradle#previous-version
remote:
remote: Thanks,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Gradle app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to all-books-store.
remote:
To https://git.heroku.com/all-books-store.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/all-books-store.git'
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Gradle app detected
remote: -----> Spring Boot detected
remote: -----> Installing OpenJDK 1.8... done
remote: -----> Building Gradle app...
remote: -----> executing ./gradlew build -x check
remote: Downloading https://services.gradle.org/distributions/gradle-7.4.1-bin.zip
remote: ...........10%...........20%...........30%...........40%...........50%...........60%...........70%...........80%...........90%...........100%
remote: To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.4.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
remote: Daemon will be stopped at the end of the build
remote: > Task :compileJava FAILED
remote:
remote: FAILURE: Build failed with an exception.
remote:
remote: * What went wrong:
remote: Execution failed for task ':compileJava'.
remote: > invalid source release: 17
remote:
remote: * Try:
remote: > Run with --stacktrace option to get the stack trace.
remote: > Run with --info or --debug option to get more log output.
remote: > Run with --scan to get full insights.
remote:
remote: * Get more help at https://help.gradle.org
remote:
remote: BUILD FAILED in 23s
remote: 1 actionable task: 1 executed
remote:
remote: ! ERROR: Failed to run Gradle!
remote: We're sorry this build is failing. If you can't find the issue in application
remote: code, please submit a ticket so we can help: https://help.heroku.com
remote: You can also try reverting to the previous version of the buildpack by running:
remote: $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-gradle#previous-version
remote:
remote: Thanks,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Gradle app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 04b91247a117524163405aa40742f4bd84afb3fc
remote: !
remote: ! We have detected that you have triggered a build from source code with version 04b91247a117524163405aa40742f4bd84afb3fc
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: !
Error: Error: Command failed: git push heroku main:refs/heads/main --force
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Gradle app detected
remote: -----> Spring Boot detected
remote: -----> Installing OpenJDK 1.8... done
remote: -----> Building Gradle app...
remote: -----> executing ./gradlew build -x check
remote: Downloading https://services.gradle.org/distributions/gradle-7.4.1-bin.zip
remote: ...........10%...........20%...........30%...........40%...........50%...........60%...........70%...........80%...........90%...........100%
remote: To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.4.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
remote: Daemon will be stopped at the end of the build
remote: > Task :compileJava FAILED
remote:
remote: FAILURE: Build failed with an exception.
remote:
remote: * What went wrong:
remote: Execution failed for task ':compileJava'.
remote: > invalid source release: 17
remote:
remote: * Try:
remote: > Run with --stacktrace option to get the stack trace.
remote: > Run with --info or --debug option to get more log output.
remote: > Run with --scan to get full insights.
remote:
remote: * Get more help at https://help.gradle.org
remote:
remote: BUILD FAILED in 23s
remote: 1 actionable task: 1 executed
remote:
remote: ! ERROR: Failed to run Gradle!
remote: We're sorry this build is failing. If you can't find the issue in application
remote: code, please submit a ticket so we can help: https://help.heroku.com
remote: You can also try reverting to the previous version of the buildpack by running:
remote: $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-gradle#previous-version
remote:
remote: Thanks,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Gradle app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 04b91247a117524163405aa40742f4bd84afb3fc
remote: !
remote: ! We have detected that you have triggered a build from source code with version 04b91247a117524163405aa40742f4bd84afb3fc
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 all-books-store.
remote:
To https://git.heroku.com/all-books-store.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/all-books-store.git'
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 all-books-store.
remote:
To https://git.heroku.com/all-books-store.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/all-books-store.git'
使用 GitHub 操作构建的屏幕截图。 在此处输入图像描述
这与您的要求无关。 这是实际错误,就在您引用的输出中:
remote: * What went wrong:
remote: Execution failed for task ':compileJava'.
remote: > invalid source release: 17
(为什么 Java 17 在此处无效是一个不同的问题,您可以提出不同的问题,但请参阅任务 ':compileJava' 的执行失败。> 无效的源版本:首先是 1.7 。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.