Online Java Buildpack
As explained in this
KB , the easiest way would be to use JBP_CONFIG_GROOVY env var, which is obtained from Groovy container config file,
groovy.yml, minus the .yml extension and with a prefix of JBP_CONFIG.
With that env var you can override the version and the buildpack will reach to the repository(https://java-buildpack.cloudfoundry.org/groovy, by default) and get the specified one.
cf set-env <GROOVY-APP> JBP_CONFIG_GROOVY: '{ version: 3.0.+, }'
With "3.0.+" as version you are indicating the buildpack to use the latest 3.0.x version. If you want to use a specific one, just replace it with the complete branch. E.g 3.0.7
Offline Java Buildpack
For the offline Java Buildpack you need to build a package to bundle the 3.0.x version, since even if you configure an internal repository it won't be able to access the network to download anything (that's offline buildpack's nature). So the steps are the following
- git clone the repo
- git checkout v4.xx to pick the version to package
- Edit config/groovy.yml and change the version to 3.0.+ (This will bundle latest 3.0 version to the buildpack at packaging time. You can also specify the version you want to be bundled)
- Follow the steps at this link, https://github.com/cloudfoundry/java-buildpack/#offline-package. When running 'bundle exec...' command you should see the line "Pinning groovy version to 3.0.x" and "Caching https://java-buildpack.cloudfoundry.org/groovy/groovy-3.0.x.zip", being 'x' the specified version, or latest version if you use the '+' symbol.
- Use 'cf create-buildpack' to upload the buildpack to TAS.
When pushing the Groovy app, the Groovy version will be available since it was included when it was packaged,
This doesn't require a fork or code changes, so it's supported. It would probably be something you would want to automate though, to keep up with buildpack releases.