0

I wanted to deploy my application to heroku server and I am facing this problem. Any idea?

      [INFO] BUILD FAILURE
       [INFO] ------------------------------------------------------------------------
       [INFO] Total time:  13.339 s
       [INFO] Finished at: 2021-08-09T04:05:01Z
       [INFO] ------------------------------------------------------------------------
       [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project russion_spring_boot: Fatal error compiling: invalid target release: 11 -> [Help 1]
       [ERROR] 
       [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
       [ERROR] Re-run Maven using the -X switch to enable full debug logging.
       [ERROR] 
       [ERROR] For more information about the errors and possible solutions, please read the following articles:
       [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
 !     ERROR: Failed to build app with Maven
       We're sorry this build is failing! If you can't find the issue in application code,
       please submit a ticket so we can help: https://help.heroku.com/
 !     Push rejected, failed to compile Java app.
 !     Push failed

   <properties>
        <java.version>15.0.1</java.version>
    </properties>
2
  • What is the JDK version you are using? Please add the output of mvn -v Commented Aug 9, 2021 at 4:43
  • Apache Maven 3.8.1 Java version: 15.0.1 Commented Aug 9, 2021 at 4:53

1 Answer 1

2

Logs depict the error - invalid target release: 11. Basically this error means that you have mentioned higher/mismatched version of Java in maven compiler's source and target java version settings in your pom.xml compared to the JDK which is being pointed out by JAVA_HOME environment variable.

To fix this error, just check the Java version in pom.xml and JAVA_HOME. They should match.

To know more about this issue, check this post - https://dzone.com/articles/how-to-fix-invalid-target-release-17-18-19-or-110

Sign up to request clarification or add additional context in comments.

11 Comments

I think they match, please take a lookt at my pom.xml file where I wrote my java version.
But what is there in JAVA_HOME. Can you provide full output of mvn --version.
Yes, sure here it is C:\Users\bekja>mvn -version Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: C:\Program Files\apache-maven-3.8.1\bin\.. Java version: 15.0.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-15.0.1 Default locale: ru_RU, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Two changes I would suggest: 1) Change java.version to 15 in pom.xml. 2) Add maven.compiler.source and maven.compiler.target properties in pom.xml along with java.version. Both will have same value as that of java.version.
I did exactly as you said, here I am getting this problem again Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project demo: Fatal error compi ling: invalid target release: 15 -> [Help 1]
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.