How to configure buildpack bindings with the spring-boot-maven-plugin?

3.1k Views Asked by At

I am using the spring-boot-maven-plugin in the latest version 2.4.0 to build images. https://docs.spring.io/spring-boot/docs/2.4.0/maven-plugin/reference/htmlsingle/#build-image

The documentation describes how the environment variables of the used buildbacks are set. https://docs.spring.io/spring-boot/docs/2.4.0/maven-plugin/reference/htmlsingle/#build-image-example-builder-configuration

But some of the configurations of the buildpacks are made with bindings. E.g. the dependency-mapping. https://github.com/paketo-buildpacks/bellsoft-liberica

How can one use these bindings with the spring-boot-maven-plugin?

1

There are 1 best solutions below

4
On

According to the docs:

Paketo Buildpacks may download dependencies from the internet. For example, the Java Buildpack will download the BellSoft Liberica JRE from the Liberica github releases by default. If a dependency URI is inaccessible from the build environment, a binding can be used to map a new URI to a given dependency.

AFAIK currently it isn't possible to define bindings through the spring-boot-maven-plugin. I also scanned some code of github.com/paketo-buildpacks/bellsoft-liberica but I didn't catch other/undocumented environment variables for that we could have used as a work-around. For now you need to stick with pack CLI and define a binding and substitute the mvn spring-boot:build-image command with this.

I can recommend this stackoverflow Q&A with the answer on how to use pack CLI with bindings to configure a different JDK download uri to solve your problem.