I had a similar problem where I needed to configure the download uri of the bellsoft-liberica JDK used inside the Spring Boot build image goal/task to not use github.com - but my own private server instead. It cannot be done with buildpack environment variable alone, but you can use bindings for that!
Please note that with the Spring Boot Gradle Plugin or Spring Boot Maven Plugin it requires Spring Boot 2.5+ (a bindings
option has been added in 2.5). If you're on an older Spring Boot release, you need to either upgrade or switch over to pack CLI.
Bindings can be configured either through volumes or Kubernetes secrets. I created a fully comprehensible guide on how to use bindings in order to change a uri used inside a buildpack - but I will outline the key steps for switching the spring-cloud-bindings-x.y.z.jar uri:
1. Create bindings directory
In order to hand over the binding configuration to pack
CLI we need to create a directory first:
mkdir spring-cloud-config && cd spring-cloud-config
2. Create file type, containing the binding key
Now we need to create a file called type
inside this directory containing the binding key for the spring-boot buildpack binding type dependency-mapping
:
echo "dependency-mapping" >> type
3. Create file named as the sha256, containing the spring-cloud-bindings-x.y.z.jar uri
Now we should create another file named exactly according to the sha256
digest value of the [[metadata.dependencies]]
section of the spring-cloud-bindings-1.7.0.jar
inside the buildpack.toml:
[[metadata.dependencies]]
id = "spring-cloud-bindings"
name = "Spring Cloud Bindings"
version = "1.7.0"
uri = "https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar"
sha256 = "e3c18bf1a3c2e52743f9ff2fa46af59e5eee0a7f0683ff562eb35aa866e4a9e9"
stacks = [ "io.buildpacks.stacks.bionic", "org.cloudfoundry.stacks.cflinuxfs3" ]
This file must contain the uri of your internal nexus incl. the spring-cloud-bindings.jar:
echo "http://<my nexus server>/repository/spring-io-releases/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar" >> e3c18bf1a3c2e52743f9ff2fa46af59e5eee0a7f0683ff562eb35aa866e4a9e9
4. Execute pack CLI with --volume to use the binding
Finally we can issue our pack
CLI command. Ensure that pack CLI is installed on your system:
pack build your-application-name-here \
--path . \
--volume $(pwd)/spring-cloud-config:/platform/bindings/spring-cloud-config \
--builder paketobuildpacks/builder:base
Alternatively, you can use the bindings
option with Spring Boot 2.5+ Maven or Gradle plugins, see links above.
Now the spring-boot buildpack will download the spring-cloud-bindings-1.7.0.jar
from http://<my nexus server>/repository/spring-io-releases/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar
instead of https://repo.spring.io/release
.