尝试在Heroku云中部署spring引导应用程序,在编译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
看起来您在默认JDK(OpenJDK 8
(上运行,但您的代码使用稍后添加的List.of
(Java 9(。
在system.properties
文件中设置所需的Java版本,该文件位于项目的根目录中
java.runtime.version=9