【问题标题】:How to deploy spring boot to heroku?如何将spring boot部署到heroku?
【发布时间】:2021-10-12 20:14:39
【问题描述】:

我想将我的应用程序部署到 heroku 服务器,但我遇到了这个问题。有什么想法吗?

      [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>

【问题讨论】:

  • 你使用的JDK版本是多少?请添加mvn -v的输出
  • Apache Maven 3.8.1 Java 版本:15.0.1

标签: java spring spring-boot heroku intellij-idea


【解决方案1】:

日志描述了错误 - invalid target release: 11。基本上,这个错误意味着您在pom.xml 中的 maven 编译器的源和目标 java 版本设置中提到了更高/不匹配的 Java 版本,而JAVA_HOME 环境变量指出了 JDK。

要修复此错误,只需检查 pom.xmlJAVA_HOME 中的 Java 版本即可。它们应该匹配。

要了解有关此问题的更多信息,请查看此帖子 - https://dzone.com/articles/how-to-fix-invalid-target-release-17-18-19-or-110

【讨论】:

  • 我认为它们匹配,请查看我编写 java 版本的 pom.xml 文件。
  • 但是JAVA_HOME 中有什么。你能提供mvn --version的完整输出吗?
  • 是的,确定这里是 C:\Users\bekja>mvn -version Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven 主页:C:\Program Files\apache-maven-3.8.1\bin \.. Java 版本:15.0.1,供应商:Oracle Corporation,运行时:C:\Program Files\Java\jdk-15.0.1 默认语言环境:ru_RU,平台编码:Cp1252 操作系统名称:“windows 10”,版本:“ 10.0”,拱门:“amd64”,家庭:“windows”
  • 我建议进行两个更改:1) 将pom.xml 中的java.version 更改为15。 2) 在pom.xmljava.version 中添加maven.compiler.sourcemaven.compiler.target 属性。两者的值都与java.version 相同。
  • 我完全按照你说的做了,这里我又遇到了这个问题 无法执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile)关于项目演示:致命错误编译:无效目标版本:15 -> [帮助 1]
猜你喜欢
  • 2022-08-10
  • 2021-07-25
  • 2017-11-06
  • 2017-12-03
  • 2020-03-30
  • 1970-01-01
  • 2021-04-15
  • 1970-01-01
  • 2020-12-01
相关资源
最近更新 更多