CloudFoundry Java buildpack fork - Instructions to add extra functionality to the buildpack

Document ID : KB000091850
Last Modified Date : 06/09/2018
Show Technical Document Details
The Java Buildpack only supports a few properties to be set in the env keys that are passed to the agent, for example, to be able to enable Leakhunter and change its properties you must create an "offline buildpack".  This document provides step by step instructions on modifying the Java Buildpack in a CloudFoundry (CF) environment.
APM 10.7
1. To add extra functionality to the buildpack, start by first forking the java buildpack into a separate Github repo. 

Forking the buildpack can be done by visting the buildpack repo at

and clicking the “Fork” button near the top right corner.

Ensure that you are signed into Github, otherwise the fork operation cannot be completed.

2. Once the buildpack is forked to your Github account, clone the repository to your local machine. The command is given below.
3. Once the repository is cloned to your local machine, edit the lib/java_buildpack/framework/introscope_agent.rb file.

Add a new method called leak_hunter, as shown below. This will be for the
“introscope.agent.leakhunter.enable” property.

def leak_hunter(credentials)

Add another method called leak_sensitivity, as shown below. This
will be for the “introscope.agent.leakhunter.leakSensitivity” property.

def leak_sensitivity(credentials)

4. Once the above two methods are added, continue editing the same file as in step 3, but this time, edit the release method. Before the method ends call both of these methods in step 3, in the release method, as shown below. def release
java_opts.add_system_property(‘introscope.agent.leakhunter.enable’, leak_hunter(credentials))
java_opts.add_system_property(‘introscope.agent.leakhunter.leakSensitivity’, leak_sensitivity(credentials))​


5. After completing step 4, you are finished with the coding portion. You must commit and push your changes with the command:

$ git commit -am “<message here>”
$ git push

6. Next, edit your manifest.yml file by adding the key below:


7. Deploy your agent to CloudFoundry, and when creating the service, pass the following keys

$ cf cups introscope -p “url, leak_hunter, leak_sensitivity”

url> Enter the agent manager URL here
leak_hunter> true
leak_sensitivity> 5