【发布时间】:2018-09-29 05:07:26
【问题描述】:
我尝试部署在 Java EE 平台上构建的应用程序。当我运行命令git push heroku master 时,在部署结束时,会生成许多错误。
主要的例外是:use -source 7 or higher to enable diamond operator。
有人知道这个错误吗?贝娄是更多错误消息。 如果你能帮助我,谢谢。
[ERROR] -> [Help 1]
remote: [ERROR]
remote: [ERROR] To see the full stack trace of the errors, re-run
Maven with the -e switch.
remote: [ERROR] Re-run Maven using the -X switch to enable full
debug logging.
remote: [ERROR]
remote: [ERROR] For more information about the errors and possible
solutions, please read the following articles:
remote: [ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
remote:
remote: ! ERROR: Failed to build app with Maven
remote: We're sorry this build is failing! If you can't find the
issue in application code,
remote: please submit a ticket so we can help:
https://help.heroku.com/
remote:
remote: ! Push rejected, failed to compile Java app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to wiidas-jee.
【问题讨论】:
-
来自Oracle's documentation of
javac:javac -source 1.7(或您需要的任何源版本) -
嗨@Turing85。但是我的编译环境是1.8。见下文:
openjdk version "1.8.0_162" OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-1~deb9u1-b12) OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode) -
是的。在您的 pom.xml 中指定源兼容性(请不要问我如何 - 我不使用 maven)。这样,您可以确保始终以指定的源兼容性编译您的源代码。问题不在您的本地站点,而是在 herokus 端(远程编译失败)。
-
必须配置maven-compiler-plugin。
-
@Turing85 和 Thorbjørn Ravn Andersen。谢谢你帮助我!在阅读了有关如何在 Heroku 中设置 Maven 的更多信息后,我找到了解决方案!添加codefinger的响应的xml标签(还有一些修改)。
标签: java git maven heroku jakarta-ee