Search code examples
spring-bootherokuintellij-idea

How to resolve compileJava errors during heroku deployment?


I worked as follows to deploy Intellij Spring Boot using gradle on heroku. I proceeded from the directory containing the source files.

> git init
> git add .
> git commit -m "first commit"
> heroku create
> git push heroku master

However, the following error occurred during the push process.

enter image description here

What went wrong: Execution failed for task ':compileJava'. invalid source release: 11

After the problem occurred, a file called system.properties was also created in the source file and the following input was also entered.

java.runtime.version=11

But it is still unresolved. How do I solve this problem?


Solution

  • First you have to ensure your local development and your deployed instance are using the same version.

    You specified a version with system.properties with content java.runtime.version=11 but haven't provided an image of the updated log. The log still says you are installing JDK 1.8.

    Furthermore you should specify a Java version that is currently being supported. You can find the versions here: https://devcenter.heroku.com/articles/java-support#supported-java-versions

    Java 7 - 1.7.0_302  
    Java 8 - 1.8.0_292  
    Java 11 - 11.0.11  
    Java 13 - 13.0.7  
    Java 15 - 15.0.3  
    Java 16 - 16.0.1