Open cmoulliard opened 4 months ago
The origin of the issue is because when we generate a quarkus project using maven, then it sets the maven compiler to 21 using Quarkus >= 3.8
To get rid of that, we can generate a project where we select the JDK like this
mvn io.quarkus.platform:quarkus-maven-plugin:3.8.3:create \
-DprojectGroupId=dev.snowdrop \
-DprojectArtifactId=quarkus-hello \
-DjavaVersion=17 \
-DprojectVersion=1.0 \
-DplatformVersion=3.8.3 \
-Dextensions='resteasy-reactive,kubernetes,buildpack'
Question: Is there a way to figure out which JDK is packaged (11, 17, 21) by default within the paketo community UBI builder image (paketocommunity/builder-ubi-base:0.0.54) ? Can we override it part of the extension execution (using our own Dockerfile maybe) ?
Question: Is there a way to figure out which JDK is packaged (11, 17, 21) by default within the paketo community UBI builder image (paketocommunity/builder-ubi-base:0.0.54) ? Can we override it part of the extension execution (using our own Dockerfile maybe) ?
No JDKs are packaged within the paketo community UBI builder image. The JDK is installed into the builder image during the extend phase by microdnf, which obtains it from the UBI repository for the appropriate version of the runtime.
The version is resolved using libjvm (a paketo library for java buildpack related stuff), that lib will look at the version detected/requested by any maven/gradle etc build files, and will use BP_JVM_VERSION if set, and if all that fails, will fall back to the version defaulted in the extension.toml for the ubi java extension (currently 17 .. https://github.com/paketo-community/ubi-java-extension/blob/main/extension.toml )
Latest paketo community UBI image cannot build quarkus 3.9 no matter if we set
BP_JVM_VERSION
to use as value17
or21
. What should we do ? @BarDweller
Note that 21 is not a valid option for the paketocommunity UBI builder image, we have PRs pending to add it, and are working through them.
-e BP_MAVEN_BUILT_ARTIFACT="target/quarkus-app/lib/ target/quarkus-app/*.jar target/quarkus-app/app/ target/quarkus-app/quarkus/" \ -e BP_MAVEN_BUILD_ARGUMENTS="package -DskipTests=true -Dmaven.javadoc.skip=true -Dquarkus.package.type=fast-jar" \
Also, note that these should not be required when using the paketocommunity UBI builder image, as the image contains the paketo quarkus buildpack that will detect quarkus projects and handle this for you.
As JDK 21 is not yet available I will then use 17
which is available [extender (build)] Installing: java-17-openjdk-headless;1:17.0.10.0.7-2.el8;x86_64;ubi-8-appstream-rpms
and force maven to use it when the quarkus project is created
mvn io.quarkus.platform:quarkus-maven-plugin:3.8.3:create \
-DprojectGroupId=dev.snowdrop \
-DprojectArtifactId=quarkus-hello \
-DjavaVersion=17 \
-DprojectVersion=1.0 \
-DplatformVersion=3.8.3 \
-Dextensions='resteasy-reactive,kubernetes,buildpack'
So running now this pack command works
REGISTRY_HOST="kind-registry.local:5000"
docker rmi ${REGISTRY_HOST}/quarkus-hello:1.0
pack build ${REGISTRY_HOST}/quarkus-hello:1.0 \
--builder paketocommunity/builder-ubi-base:0.0.54 \
-e BP_NATIVE_IMAGE="false" \
-e BP_JVM_VERSION="17" \
--volume $HOME/.m2:/home/cnb/.m2:rw \
--path .
...
[extender (build)] Paketo Buildpack for Executable JAR 6.8.5
[extender (build)] https://github.com/paketo-buildpacks/executable-jar
[extender (build)]
[extender (build)] Process types:
[extender (build)] executable-jar: java -jar /workspace/quarkus-run.jar (direct)
[extender (build)] task: java -jar /workspace/quarkus-run.jar (direct)
[extender (build)] web: java -jar /workspace/quarkus-run.jar (direct)
===> EXPORTING
[exporter] Adding layer 'paketo-community/ubi-java-buildpack:ajre'
[exporter] Adding layer 'paketo-community/ubi-java-buildpack:helper'
[exporter] Adding layer 'paketo-community/ubi-java-buildpack:java-security-properties'
[exporter] Adding layer 'paketo-buildpacks/ca-certificates:helper'
[exporter] Adding layer 'buildpacksio/lifecycle:launch.sbom'
[exporter] Adding 5/5 app layer(s)
[exporter] Adding layer 'buildpacksio/lifecycle:launcher'
[exporter] Adding layer 'buildpacksio/lifecycle:config'
[exporter] Adding layer 'buildpacksio/lifecycle:process-types'
[exporter] Adding label 'io.buildpacks.lifecycle.metadata'
[exporter] Adding label 'io.buildpacks.build.metadata'
[exporter] Adding label 'io.buildpacks.project.metadata'
[exporter] Setting default process type 'web'
[exporter] Saving kind-registry.local:5000/quarkus-hello:1.0...
[exporter] *** Images (f44f6ea63d6d):
[exporter] kind-registry.local:5000/quarkus-hello:1.0
[exporter] Reusing cache layer 'paketo-buildpacks/syft:syft'
[exporter] Reusing cache layer 'paketo-buildpacks/maven:application'
[exporter] Reusing cache layer 'paketo-buildpacks/maven:cache'
[exporter] Reusing cache layer 'buildpacksio/lifecycle:cache.sbom'
Successfully built image kind-registry.local:5000/quarkus-hello:1.0
Issue
Latest paketo community UBI image cannot build quarkus 3.9 no matter if we set
BP_JVM_VERSION
to use as value17
or21
.What should we do ? @BarDweller