【问题标题】:Heroku deployed failed for springboot application?春季启动应用程序的Heroku部署失败?
【发布时间】:2021-08-31 07:26:07
【问题描述】:

尝试在 Heroku 云中部署 spring-boot 应用程序,出现错误无法编译 java 应用程序,但这在我的本地机器上运行良好。

       [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project smartcontactmanager: Compilation failure
       [ERROR] /tmp/build_f6591bb6/src/main/java/com/smart/config/CustomUserDetails.java:[29,28] cannot find symbol
       [ERROR]   symbol:   method of(org.springframework.security.core.authority.SimpleGrantedAuthority)
       [ERROR]   location: interface java.util.List
       [ERROR] -> [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/MojoFailureException
 !     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

【问题讨论】:

  • 如果这在您的系统中运行良好,那么您可以尝试查看 git 跟踪的文件吗?您可能会错过将一个文件推送到heroku。
  • 所有文件工作正常,不明白为什么我收到错误
  • 如果编译失败,则可能是一些依赖问题,或者某些文件可能没有推送到 Heroku。你可以试试git diff heroku/master 看看有没有什么问题。
  • 得到上述问题的解决方案,问题归还列表

标签: java spring-boot heroku


【解决方案1】:

看起来您是在默认 JDK (OpenJDK 8) 上运行,但您的代码使用的是 List.of,稍后添加 (Java 9)。

system.properties 文件中的Set the desired Java 版本,位于项目的根目录中

java.runtime.version=9

【讨论】:

    猜你喜欢
    • 2018-05-20
    • 2021-06-08
    • 1970-01-01
    • 1970-01-01
    • 2014-10-08
    • 2023-03-05
    • 2016-12-13
    • 2021-06-10
    • 2018-06-15
    相关资源
    最近更新 更多