How to override Java Buildpack default configuration
search cancel

How to override Java Buildpack default configuration

book

Article ID: 297478

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

Some times you may need to change the Java Buildpack default configuraion, such as JDK, tomcat or Groovy versions; or even the JRE vendor/distribution.

For more details , please see https://github.com/cloudfoundry/java-buildpack#configuration-and-extension 
 


Resolution

The buildpack default configuration can be overridden with an environment variable matching the configuration file you wish to override minus the .yml extension and with a prefix of JBP_CONFIG. Those config files are in the config folder. E.g 

  • components.yml can be modified to change the available containers, JRE vendor or Framework.
  • open_jdk_jre.yml can be modified to configure OpenJDK JRE.
  • tomcat.yml can be modified to configure the tomcat container

It is not possible to add new configuration properties and properties with nil or empty values will be ignored by the buildpack (in this case you will have to extend the buildpack, see below). The value of the variable should be valid inline yaml, referred to as "flow style" in the yaml spec (Wikipedia has a good description of this yaml syntax). For example, to change the default version of Java to 11 and adjust the memory heuristics apply this environment variable to the application.

$ cf set-env my-application JBP_CONFIG_OPEN_JDK_JRE '{ jre: { version: 11.+ }, memory_calculator: { stack_threads: 25 } }'

For more details, please see https://github.com/cloudfoundry/java-buildpack#configuration-and-extension