首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SpringBoot Heroku org.maven.plugins:maven-compiler-plugin:3.8.1:compile失败

SpringBoot Heroku org.maven.plugins:maven-compiler-plugin:3.8.1:compile失败
EN

Stack Overflow用户
提问于 2020-11-10 07:06:13
回答 2查看 288关注 0票数 2

嗯,我已经看过其他帖子了,但是不能解决我的问题。我正在尝试将springboot项目部署到heroku,但是发生了这个错误。无法对项目执行目标编译(默认编译):致命错误编译:无效的目标版本: 11 -> org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile 1

我遵循了heroku的指南:

代码语言:javascript
复制
$ git init
$ heroku git:remote -a <project>
$ git add .
$ git commit -am "first"
$ git push heroku master

错误:

代码语言:javascript
复制
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

代码语言:javascript
复制
<?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>

可能的问题是什么?如何解决?求求你我需要帮助

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-11-10 07:41:38

我可以通过将所有东西都降级到1.8版本来解决这个问题,包括我的路径

票数 0
EN

Stack Overflow用户

发布于 2021-08-08 13:38:06

变化

代码语言:javascript
复制
<java.version>11</java.version>

代码语言:javascript
复制
<java.runtime.version>11</java.runtime.version>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64760529

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档