简体   繁体   中英

git push heroku master rejected

I want to deploy my first springboot app with mysql to heroku (using git and heroku cli), but failed when running git push heroku master rejected.

remote:        [INFO] Changes detected - recompiling the module!
remote:        [INFO] Compiling 7 source files to /tmp/build_c5e0f2b5/target/classes
remote:        [INFO] ------------------------------------------------------------------------
remote:        [INFO] BUILD FAILURE
remote:        [INFO] ------------------------------------------------------------------------
remote:        [INFO] Total time:  8.934 s
remote:        [INFO] Finished at: 2022-07-27T16:58:41Z
remote:        [INFO] ------------------------------------------------------------------------
remote:        [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project MyWebApp: Fatal error compiling: invalid target release: 18 -> [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/MojoExecutionException
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: ff84352b22a5ff214782161029fd4ff8ec067734
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version ff84352b22a5ff214782161029fd4ff8ec067734
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 aien-app-1.
remote:
To https://git.heroku.com/aien-app-1.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/aien-app-1.git'

Does anyone know how to solve it?I beg for help

It looks like your code does not compile for some reason. That may be due to the git branch you are on. Have you tried the suggested:

git push heroku <branchname>:main

It appears you're pushing to the wrong branch since Heroku now deploys from the main branch by default. First run

git branch

to see what branch you're on. For example, if it shows an asterisk next to master, then run

git push heroku master:main

or if it says main,

git push heroku main:main # or "git push heroku main"

More information can be seen at the link in your command's output ( here )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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