如何在Heroku上将JDK 1.8更改为JDK 11?

huangapple go评论66阅读模式
英文:

How can I change JDK 1.8 to JDK 11 in Heroku?

问题

我为Bitbucket创建了部署应用程序到Heroku的流水线。我使用Java 11,但Heroku安装了1.8。

我该如何修复这个问题?

我还在main/resources中创建了system.properties,指定了JDK和Maven的版本。

英文:

I created pipelines for bitbucket to deploy app to Heroku. I use java 11 but Heroku installs 1.8.
如何在Heroku上将JDK 1.8更改为JDK 11?

How to fix it?

I also created system.properties in main/resources indicating JDK and Maven versions:

如何在Heroku上将JDK 1.8更改为JDK 11?

答案1

得分: 2

在您的目录中创建一个 system.properties 文件并提交到 git。
更多信息请参阅 https://devcenter.heroku.com/articles/customizing-the-jdk#prerequisites,有关更多信息请查阅文档。

英文:

Create a system.properties file in your directory and commit to git.
more info https://devcenter.heroku.com/articles/customizing-the-jdk#prerequisites see doc for more info.

答案2

得分: 0

首先,通过使用 git ls-files 命令,确定 system.properties 文件是否已被添加到您的 Git 仓库中。

其次,检查文件的前 3 个字节是否不是 UTF-8 BOM

英文:

Firstly, check what the system.properties file definitely got into your Git-repository by using git ls-files.

Secondly, check what the first 3 bytes of the file are not UTF-8 BOM.

答案3

得分: 0

README

如果你不想像我一样在代码中添加额外的文件(system.properties),那么这个答案会对你有所帮助。


思路:将Java构建包的默认JDK版本从1.8更改为11。

步骤:

  1. 克隆官方的Java构建包:https://github.com/heroku/heroku-buildpack-java,例如:https://github.com/archongum/heroku-buildpack-java
  2. 找到默认JDK版本的变量所在位置。

如何在Heroku上将JDK 1.8更改为JDK 11?

  1. 提交变更并推送到GitHub。
  2. 在Heroku中添加你自己的构建包。
    如何在Heroku上将JDK 1.8更改为JDK 11?
  3. 触发部署,完成。
    如何在Heroku上将JDK 1.8更改为JDK 11?
英文:

README

If you don't want to add a additional file (system.properties) in your code like me, then this answer would help.


Idea: Change java buildpack jdk default version from 1.8 to 11

Step:

  1. Fork official java buildpack: https://github.com/heroku/heroku-buildpack-java. e.g. https://github.com/archongum/heroku-buildpack-java
  2. Find out where the default jdk version variable is.

如何在Heroku上将JDK 1.8更改为JDK 11?

  1. Commit changes and Push to GitHub
  2. Add your own buildpack in Heroku
    如何在Heroku上将JDK 1.8更改为JDK 11?
  3. Trigger deploy and done
    如何在Heroku上将JDK 1.8更改为JDK 11?

huangapple
  • 本文由 发表于 2020年8月31日 05:10:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/63662184.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定