2

I created pipelines for bitbucket to deploy app to Heroku. I use java 11 but Heroku installs 1.8. enter image description here

How to fix it?

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

enter image description here

Nowhere Man
  • 19,170
  • 9
  • 17
  • 42
  • I think this [link](https://devcenter.heroku.com/articles/java-support#specifying-a-java-version) can help you – Neto Deolino Aug 30 '20 at 21:23
  • I'm sorry. I forgot to mention that I did it. [image](https://snipboard.io/gYabGD.jpg) – Denis Romanenko Aug 30 '20 at 21:31
  • 1
    @DenisRomanenko, possibly you should add `system.properties` to the root directory of your application and check `JAVA_HOME` env variable as described here: [Could not target platform: 'Java SE 9' using tool chain: 'JDK 8 (1.8)'](https://stackoverflow.com/questions/47500674/gradle-java9-could-not-target-platform-java-se-9-using-tool-chain-jdk-8-1) – Nowhere Man Aug 30 '20 at 23:23

3 Answers3

2

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.

Abrar Ansari
  • 127
  • 8
0

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.

happy_marmoset
  • 2,137
  • 3
  • 20
  • 25
0

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.

enter image description here

  1. Commit changes and Push to GitHub
  2. Add your own buildpack in Heroku enter image description here
  3. Trigger deploy and done enter image description here
Archon
  • 1,385
  • 1
  • 15
  • 30