See https://github.com/buildpacks/pack/issues/2154 for the equivalent pack option. The value of a platform option should be passed to the lifecycle API as provided by the user.

Comment From: StefanLobbenmeierObjego

Current workaround is running pack manually, in my case something like this:

pack build  --platform linux/amd64 \
            --builder paketobuildpacks/builder-jammy-base:latest \
            --buildpack paketo-buildpacks/java \
            --env BP_JVM_VERSION=21 \
            putyourimagenamehere

And if you want to run the gradle build outside of docker make sure to pass the executable .jar file:

jar_path=$(build/libs -maxdepth 1 -name "*.jar" -not -name "*plain.jar" -print -quit)
pack build  --platform linux/amd64 \
            --builder paketobuildpacks/builder-jammy-base:latest \
            --buildpack paketo-buildpacks/java \
            --path $jar_path \
            --env BP_JVM_VERSION=21 \
            putyourimagenamehere

Comment From: scottfrederick

While many phases of the CNB lifecycle API do have a -platform option, that option is not related to the --platform option added to the pack CLI. Instead of passing the value of this new option to the lifecycle API, we should pass the value to the Docker Engine API when pulling images and creating containers from images.

To reduce the potential for confusion, we should call the new options in the Maven and Gradle configuration imagePlatform instead of just platform.

Comment From: ChildrenGreens

@scottfrederick Well done! Looking forward to the official release of version 3.4.0!

Comment From: filipblondeel

@scottfrederick Does this support specifying multiple platforms, for example linux/amd64 and linux/arm64?

Comment From: scottfrederick

@filipblondeel Only one platform option can be specified. Supporting multiple platform options would require Spring Boot to iterate over the entire image-building process for each option.