在Heroku上部署Spring引导项目时出错(无效的目标版本) [英] Error deploying my Spring boot project on Heroku (invalid target release)

查看:50
本文介绍了在Heroku上部署Spring引导项目时出错(无效的目标版本)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//Pom.xml文件

// Pom.xml file

4.0.0org.springframework.boot弹簧启动启动器父母2.3.3发行com.SpringBootJavaProject学习项目0.0.1-快照学习项目Spring Boot的演示项目

4.0.0 org.springframework.boot spring-boot-starter-parent 2.3.3.RELEASE com.SpringBootJavaProject LearningProject 0.0.1-SNAPSHOT LearningProject Demo project for Spring Boot

<properties>
    <java.version>14</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-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <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>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            </plugin>

        <plugin>
            <groupId>com.heroku.sdk</groupId>
            <artifactId>heroku-maven-plugin</artifactId>
            <version>3.0.3</version>
        </plugin>
    </plugins>


</build>

//错误描述[错误]无法在项目LearningProject上执行目标org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile(默认编译):致命错误编译:无效目标版本:14->[帮助1]

// Error Desciption [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project LearningProject: Fatal error compiling: invalid target release: 14 -> [Help 1]

推荐答案

Heroku默认使用OpenJDK 8.

Heroku uses OpenJDK 8 as default.

更改为使用Java 8或在system.properties文件(位于项目的根目录)中设置所需的Java版本,该文件应包含:

Change to use Java 8 or set your desired Java version in the system.properties file (at the root of your project), the file should contain:

java.runtime.version=14

这篇关于在Heroku上部署Spring引导项目时出错(无效的目标版本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆