Java HEROKU使用-source 7或更高版本启用菱形运算符
我试图在JavaEE平台上部署我的应用程序。当我在部署结束时运行命令gitpushHeroku master时,会产生许多错误 主要的例外情况是:Java HEROKU使用-source 7或更高版本启用菱形运算符,java,git,maven,heroku,jakarta-ee,Java,Git,Maven,Heroku,Jakarta Ee,我试图在JavaEE平台上部署我的应用程序。当我在部署结束时运行命令gitpushHeroku master时,会产生许多错误 主要的例外情况是:使用-source 7或更高版本来启用菱形运算符 有人知道这个错误吗?下面是更多的错误信息。 如果你能帮助我,谢谢你 [ERROR] -> [Help 1] remote: [ERROR] remote: [ERROR] To see the full stack trace of the errors, re-ru
使用-source 7或更高版本来启用菱形运算符
有人知道这个错误吗?下面是更多的错误信息。
如果你能帮助我,谢谢你
[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.
将以下插件和配置添加到您的
pom.xml
:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
From:
javac-source1.7
(或您需要的任何源代码版本)Hi@Turing85。但是我的编译环境是1.8。请参阅以下内容:openjdk版本“1.8.0_162”openjdk运行时环境(构建1.8.0_162-8u162-b12-1~deb9u1-b12)openjdk 64位服务器虚拟机(构建25.162-b12,混合模式)
。在pom.xml中指定源代码兼容性(请不要问我如何-我不使用maven)。这样,您就可以确保您的源代码总是按照指定的源代码兼容性进行编译。问题不在本地站点,而是在herokus端(远程编译失败)。您必须配置maven编译器插件。@Turing85和Thorbjørn Ravn Andersen。谢谢你帮助我!在阅读了更多关于如何在Heroku中设置Maven的内容后,我找到了解决方案!添加codefinger响应的xml标记(还有一些修改)。嗨@codefinger!你的回答对我的解决方案非常重要。粘贴此标记后,进行提交和推送,生成无法工作。但是,我搜索了生成的异常,并将maven的版本更改为3.8.2。在这之后,他做得很好。谢谢。远程:[INFO]构建成功远程:[INFO]-------------------------------------远程:[INFO]总时间:02:11分钟远程:[INFO]完成时间:2018-04-19T13:45:48+00:00远程:[INFO]最终内存:38M/402M远程:[INFO] ------------------------------------------------------
$ git add pom.xml
$ git commit -m "pom.xml"
$ git push heroku master