目标版本无效:推送 heroku 存储库时为 12 [英] Invalid target release: 12 when pushing the heroku repo

查看:61
本文介绍了目标版本无效:推送 heroku 存储库时为 12的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我 git push heroku master 时都会出错,这就是错误

I have an error whenever I git push heroku master and this is the error

无法在项目后端执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile): Fatal error compiling: invalid target release: 12

我不确定为什么这个错误不断出现,我想我用我的 pom.xml 文件修复了它,但似乎我做错了什么

I am unsure why this error keeps coming up and I figured I fixed it with my pom.xml file, but it seems that I am doing something wrong

<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.1.8.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.backend</groupId>
    <artifactId>backend</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>12</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-websocket</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-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>webjars-locator-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>sockjs-client</artifactId>
            <version>1.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>stomp-websocket</artifactId>
            <version>2.3.3</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.7</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>3.1.0</version>
        </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>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
        <groupId>com.google.firebase</groupId>
        <artifactId>firebase-admin</artifactId>
        <version>6.10.0</version>
        </dependency>
        <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz-jobs</artifactId>
        <version>2.2.1</version>
        </dependency>
    </dependencies>

    <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
             <configuration>
                <release>12</release>
            </configuration>
        </plugin>
    </plugins>
   </build>
</project>

请告诉我如何解决这个问题.

please tell me how to fix this problem.

谢谢

推荐答案

你需要在你的项目根目录下创建一个名为 system.properties 的文件,其中有如下一行:

You need to create a file called system.properties in the root of your project, and therein have the following line:

java.runtime.version=12

但是,Heroku 不支持运行时版本 12,仅支持奇数(因此在撰写本文时为 11、13、15).请参阅 https://devcenter.heroku.com/articles/java-support#supported-java-versions

However, Heroku does not support runtime version 12, only the odd numbers (so 11, 13, 15 as of this writing). See https://devcenter.heroku.com/articles/java-support#supported-java-versions

确保您的 pom.xmlsystem.properties 都针对相同的版本,否则会出现问题.

Be sure both your pom.xml and system.properties are targeting the same version, or headaches will ensue.

这篇关于目标版本无效:推送 heroku 存储库时为 12的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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