SpringBoot Heroku org.maven.plugins:maven编译器插件:3.8.1:编译失败



我已经看过其他帖子,但无法解决我的问题。我试图将springboot项目部署到heroku,但出现了这个错误。未能在项目上执行目标org.apache.maven.plugins:maven编译器插件:3.8.1:编译(默认编译(:编译致命错误:无效的目标版本:11->[帮助1]

我跟随heroku指南:

$ git init
$ heroku git:remote -a <project>
$ git add .
$ git commit -am "first"
$ git push heroku master

错误:

remote:        [INFO] ------------------------------------------------------------------------
remote:        [INFO] BUILD FAILURE
remote:        [INFO] ------------------------------------------------------------------------
remote:        [INFO] Total time:  12.632 s
remote:        [INFO] Finished at: 2020-11-09T22:59:42Z
remote:        [INFO] ------------------------------------------------------------------------
remote:        [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project scoringsalud-backend: Fatal error compiling: invalid target releas
e: 11 -> [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: d8ea942613535eca3b2881713d82bcbea9f267aa
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version d8ea942613535eca3b2881713d82bcbea9f267aa
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 scoringsalud.
remote:
To https://git.heroku.com/scoringsalud.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/scori

ngsalud.git'

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>scoringsalud-backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>scoringsalud-backend</name>
<description>Backend Springboot and MongoDb project for Scoring Salud</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

可能是什么问题?如何解决?我需要帮助:(

更改

<java.version>11</java.version>

<java.runtime.version>11</java.runtime.version>

我可以通过将所有内容降级到1.8版本来解决它,包括我的路径

最新更新