I'm trying to set up a Spring Boot / Gradle project to use bootBuildImage to build my Docker image, but am hitting a snag. We have limited external network access on our build servers; we use a private nexus repository.
When I try to run the bootBuildImage task, it's attempting to request a file from repo.spring.io:
[creator] unable to invoke layer creator
[creator] unable to contribute spring-cloud-bindings layer
[creator] unable to get dependency spring-cloud-bindings
[creator] unable to download https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar
[creator] unable to request https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar
I have repo.spring.io
added as a repository on our nexus server, but I'm unclear on how to get the Spring Boot Gradle plugin to use it. I tried adding it to my repositories
block, but it didn't seem to have an effect.
repositories {
// Other repositories...
//
maven {
url "<my nexus server>/repository/spring-io-releases/"
}
What am I missing?
The
bootBuildImage
Gradle task uses Paketo Buildpacks to build your OCI container. There are a bunch of buildpacks participating in the creation of the container, one of them is the Spring Boot Buildpack. Among other things, the Spring Boot Buildpack will add Spring Cloud Bindings to the application classpath:This all happens inside the build container and the buildpack is not aware of your Gradle repositories. The dependency URL is defined in the buildpack itself:
Using the environment variable
BPL_SPRING_CLOUD_BINDINGS_ENABLED
, you can disable autoconfiguring Spring Boot environment properties from bindings, but the jar file will be pulled anyway.