heroku - system.properties和java版本

And*_*dna 3 java heroku maven

我想部署我的java 7应用程序Heroku但是我遇到了java版本的一些问题.

system.properties在我的项目根目录(在哪里src和哪里pom.xml)添加了文件内容,java.runtime.version=1.7但我仍然得到这样的东西:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project lets-code: Fatal error compiling: invalid target release: 1.7
Run Code Online (Sandbox Code Playgroud)

所以我对下一步做什么感到困惑.

abr*_*nan 7

Heroku上Java的默认版本是Java 6.您需要遵循指南,使您的maven项目在较新版本的JVM(1.7或1.8)上运行.您已将system.properties文件添加到项目中.但是,您可能没有按照指定更新PATH,并且maven尝试使用OpenJDK 6构建您的应用程序,这会导致无效的目标释放异常.

更新PATH应该可以解决问题.

  • 这个怎么做? (2认同)

Eug*_*hel 5

我使用了以下指南https://devcenter.heroku.com/articles/customizing-the-jdk

\n\n
\n

指定 JDK 版本\n 创建一个 system.properties 文件(如果尚不存在),指定版本,然后将其提交到 git。Java 支持文章中描述了支持的版本。文件\xe2\x80\x99s 内容应如下所示:

\n\n

java.runtime.version=11\n 然后通过运行以下命令将文件添加到 Git:

\n\n

git add system.properties\n git commit -m "JDK 11"

\n
\n\n

这个对我有用。

\n