How to inject custom SSL certs into springbok bootBuildImage - spring

I'm not sure if this is possible w/out making a custom base image to use but I'm trying to build images behind a corporate firewall with self-signed SSL certs:
> Task :bootBuildImage
Caching disabled for task ':bootBuildImage' because:
Build cache is disabled
Task ':bootBuildImage' is not up-to-date because:
Task has not declared any outputs despite executing actions.
Building image 'docker.io/library/temp:latest'
> Pulling builder image 'gcr.io/paketo-buildpacks/builder:base-platform-api-0.3' ..................................................
> Pulled builder image 'gcr.io/paketo-buildpacks/builder#sha256:200fb7945ef0f4a3c79befb1262fd592f54ba7b7ffcc8a37716434dd11d0e5e9'
> Pulling run image 'gcr.io/paketo-buildpacks/run:base-cnb' ..................................................
> Pulled run image 'gcr.io/paketo-buildpacks/run#sha256:f7f27462fb513a70370322ada08440a642d24a700056d4c6b8cbb344610bf486'
> Executing lifecycle version v0.7.5
> Using build cache volume 'pack-cache-739c2c210811.build'
> Running creator
[creator] ---> DETECTING
[creator] ======== Results ========
[creator] pass: paketo-buildpacks/bellsoft-liberica#2.7.1
[creator] skip: paketo-buildpacks/gradle#1.2.2
[creator] skip: paketo-buildpacks/maven#1.4.2
[creator] skip: paketo-buildpacks/sbt#1.2.2
[creator] pass: paketo-buildpacks/executable-jar#1.2.5
[creator] pass: paketo-buildpacks/apache-tomcat#1.1.5
[creator] pass: paketo-buildpacks/dist-zip#1.3.2
[creator] pass: paketo-buildpacks/spring-boot#1.5.5
[creator] skip: paketo-buildpacks/procfile#1.3.5
[creator] skip: paketo-buildpacks/azure-application-insights#1.2.1
[creator] skip: paketo-buildpacks/debug#1.2.5
[creator] skip: paketo-buildpacks/google-stackdriver#1.2.1
[creator] skip: paketo-buildpacks/jmx#1.1.5
[creator] skip: paketo-buildpacks/encrypt-at-rest#1.2.5
[creator] skip: paketo-buildpacks/image-labels#1.0.5
[creator] Resolving plan... (try #1)
[creator] fail: paketo-buildpacks/bellsoft-liberica#2.7.1 provides unused jdk
[creator] Resolving plan... (try #2)
[creator] skip: paketo-buildpacks/executable-jar#1.2.5 requires jre
[creator] skip: paketo-buildpacks/apache-tomcat#1.1.5 requires jre
[creator] skip: paketo-buildpacks/dist-zip#1.3.2 requires jre
[creator] fail: paketo-buildpacks/bellsoft-liberica#2.7.1 provides unused jdk
[creator] Resolving plan... (try #3)
[creator] 5 of 15 buildpacks participating
[creator] paketo-buildpacks/bellsoft-liberica 2.7.1
[creator] paketo-buildpacks/executable-jar 1.2.5
[creator] paketo-buildpacks/apache-tomcat 1.1.5
[creator] paketo-buildpacks/dist-zip 1.3.2
[creator] paketo-buildpacks/spring-boot 1.5.5
[creator] ---> ANALYZING
[creator] Analyzing image "c48997fb4f4f2e07e64033a33545298861d1f71f6a11a992bbb17cc84ecefee5"
[creator] ---> RESTORING
[creator] ---> BUILDING
[creator]
[creator] Paketo BellSoft Liberica Buildpack 2.7.1
[creator] Set $BPL_JVM_HEAD_ROOM to configure the headroom in memory calculation. Default 0.
[creator] Set $BPL_JVM_LOADED_CLASS_COUNT to configure the number of loaded classes in memory calculation. Default 35% of classes.
[creator] Set $BPL_JVM_THREAD_COUNT to configure the number of threads in memory calculation. Default 250.
[creator] Set $BP_JVM_VERSION to configure the Java version. Default 11.*.
[creator] BellSoft Liberica JRE 8.0.252: Contributing to layer
[creator] Downloading from https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jre8u252+9-linux-amd64.tar.gz
[creator] unable to invoke layer creator
[creator] unable to get dependency jre
[creator] unable to download https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jre8u252+9-linux-amd64.tar.gz
[creator] unable to request https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jre8u252+9-linux-amd64.tar.gz
[creator] Get "https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jre8u252+9-linux-amd64.tar.gz": x509: certificate signed by unknown authority
[creator] ERROR: failed to build: exit status 1
Here is the log -> I'm wondering if there is a way to inject the SSL certs into the base container...
thanks

Have you tried following environment variables?:
DOCKER_TLS_VERIFY Enable secure HTTPS protocol when set to 1
(optional)
DOCKER_CERT_PATH Path to certificate and key files for
HTTPS (required if DOCKER_TLS_VERIFY=1, ignored otherwise)
Reference: https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/gradle-plugin/reference/html/#build-image

Related

Build of native image with Spring Boot get stuck on Apple Silicon

The build with -Pnative starts and progresses successfully, but fails to complete on my Apple Silicon Mac. Any ideas what might be missing?
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.0.2)
[INFO]
[INFO] --- jar:3.3.0:jar (default-jar) # bef-projekt-aggregat ---
[INFO] Building jar: /Users/work/IdeaProjects/wrwks/bef/bef-projekt-aggregat/target/bef-projekt-aggregat-0.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot:3.0.2:repackage (repackage) # bef-projekt-aggregat ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] <<< spring-boot:3.0.2:build-image (default-cli) < package # bef-projekt-aggregat <<<
[INFO]
[INFO]
[INFO] --- spring-boot:3.0.2:build-image (default-cli) # bef-projekt-aggregat ---
[INFO] Building image 'docker.io/library/bef-projekt-aggregat:0.0.0-SNAPSHOT'
[INFO]
[INFO] > Pulling builder image 'docker.io/paketobuildpacks/builder:tiny' 100%
[INFO] > Pulled builder image 'paketobuildpacks/builder#sha256:7f1dc12643a7d5c43d1eaa88b443099c7639e5e54a7711593fe8fa7a5929bd2f'
[INFO] > Pulling run image 'docker.io/paketobuildpacks/run:tiny-cnb' 100%
[INFO] > Pulled run image 'paketobuildpacks/run#sha256:11d6196c9185cbb5eff12410ebc14ad5a19edc6553329b5d3d2ae7a95ed723f9'
[INFO] > Pulling buildpack image 'gcr.io/paketo-buildpacks/graalvm:latest' 100%
[INFO] > Pulled buildpack image 'gcr.io/paketo-buildpacks/graalvm#sha256:a4713efaccb92123f7b58ef0426d6102276964583a4035c0fc62ba1ae5817d6e'
[INFO] > Pulling buildpack image 'gcr.io/paketo-buildpacks/java-native-image:latest' 100%
[INFO] > Pulled buildpack image 'gcr.io/paketo-buildpacks/java-native-image#sha256:2bfd09f5349a9cfe574d16e8f55b11d33a02f6bde5237ab13c755a8d7051d356'
[INFO] > Executing lifecycle version v0.16.0
[INFO] > Using build cache volume 'pack-cache-04b0171c77cc.build'
[INFO]
[INFO] > Running creator
[INFO] [creator] ===> ANALYZING
[INFO] [creator] Previous image with name "docker.io/library/bef-projekt-aggregat:0.0.0-SNAPSHOT" not found
[INFO] [creator] ===> DETECTING
[INFO] [creator] 8 of 15 buildpacks participating
[INFO] [creator] paketo-buildpacks/graalvm 7.10.0
[INFO] [creator] paketo-buildpacks/ca-certificates 3.5.1
[INFO] [creator] paketo-buildpacks/bellsoft-liberica 9.10.3
[INFO] [creator] paketo-buildpacks/syft 1.24.2
[INFO] [creator] paketo-buildpacks/executable-jar 6.6.0
[INFO] [creator] paketo-buildpacks/spring-boot 5.22.1
[INFO] [creator] paketo-buildpacks/native-image 5.8.0
[INFO] [creator] paketo-buildpacks/environment-variables 4.4.0
[INFO] [creator] ===> RESTORING
[INFO] [creator] ===> BUILDING
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for GraalVM 7.10.0
[INFO] [creator] https://github.com/paketo-buildpacks/graalvm
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_JVM_JLINK_ARGS --no-man-pages --no-header-files --strip-debug --compress=1 configure custom link arguments (--output must be omitted)
[INFO] [creator] $BP_JVM_JLINK_ENABLED false enables running jlink tool to generate custom JRE
[INFO] [creator] $BP_JVM_VERSION 19.* the Java version
[INFO] [creator] Launch Configuration:
[INFO] [creator] $BPL_DEBUG_ENABLED false enables Java remote debugging support
[INFO] [creator] $BPL_DEBUG_PORT 8000 configure the remote debugging port
[INFO] [creator] $BPL_DEBUG_SUSPEND false configure whether to suspend execution until a debugger has attached
[INFO] [creator] $BPL_HEAP_DUMP_PATH write heap dumps on error to this path
[INFO] [creator] $BPL_JAVA_NMT_ENABLED true enables Java Native Memory Tracking (NMT)
[INFO] [creator] $BPL_JAVA_NMT_LEVEL summary configure level of NMT, summary or detail
[INFO] [creator] $BPL_JFR_ARGS configure custom Java Flight Recording (JFR) arguments
[INFO] [creator] $BPL_JFR_ENABLED false enables Java Flight Recording (JFR)
[INFO] [creator] $BPL_JMX_ENABLED false enables Java Management Extensions (JMX)
[INFO] [creator] $BPL_JMX_PORT 5000 configure the JMX port
[INFO] [creator] $BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation
[INFO] [creator] $BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation
[INFO] [creator] $BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
[INFO] [creator] $JAVA_TOOL_OPTIONS the JVM launch flags
[INFO] [creator] Using Java version 19.* from BP_JVM_VERSION
[INFO] [creator] GraalVM JDK 19.0.2: Contributing to layer
[INFO] [creator] Downloading from https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java19-linux-amd64-22.3.1.tar.gz
[INFO] [creator] Verifying checksum
[INFO] [creator] Expanding to /layers/paketo-buildpacks_graalvm/nik
[INFO] [creator] Warning: The JVM cacerts entries cannot be loaded with Java 18+, for more information see: https://github.com/paketo-buildpacks/libjvm/issues/158
[INFO] [creator] GraalVM Native Image Substrate VM 19.0.2
[INFO] [creator] Downloading from https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/native-image-installable-svm-java19-linux-amd64-22.3.1.jar
[INFO] [creator] Verifying checksum
[INFO] [creator] Installing substrate VM
[INFO] [creator] Processing Component archive: /tmp/61411f4edce57666c2ecd535aa71f970dec8ab4becf7f23b322845009e02ddab/native-image-installable-svm-java19-linux-amd64-22.3.1.jar
[INFO] [creator] Installing new component: Native Image (org.graalvm.native-image, version 22.3.1)
[INFO] [creator] Writing env.build/JAVA_HOME.override
[INFO] [creator] Writing env.build/JDK_HOME.override
[INFO] [creator] Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
[INFO] [creator] Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
[INFO] [creator] Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for CA Certificates 3.5.1
[INFO] [creator] https://github.com/paketo-buildpacks/ca-certificates
[INFO] [creator] Launch Helper: Contributing to layer
[INFO] [creator] Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Syft 1.24.2
[INFO] [creator] https://github.com/paketo-buildpacks/syft
[INFO] [creator] Downloading from https://github.com/anchore/syft/releases/download/v0.69.1/syft_0.69.1_linux_amd64.tar.gz
[INFO] [creator] Verifying checksum
[INFO] [creator] Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Executable JAR 6.6.0
[INFO] [creator] https://github.com/paketo-buildpacks/executable-jar
[INFO] [creator] Class Path: Contributing to layer
[INFO] [creator] Writing env.build/CLASSPATH.delim
[INFO] [creator] Writing env.build/CLASSPATH.prepend
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Spring Boot 5.22.1
[INFO] [creator] https://github.com/paketo-buildpacks/spring-boot
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_SPRING_CLOUD_BINDINGS_DISABLED false whether to contribute Spring Boot cloud bindings support
[INFO] [creator] Launch Configuration:
[INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_DISABLED false whether to auto-configure Spring Boot environment properties from bindings
[INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_ENABLED true Deprecated - whether to auto-configure Spring Boot environment properties from bindings
[INFO] [creator] Class Path: Contributing to layer
[INFO] [creator] native args file /workspace/META-INF/native-image/argfile
[INFO] [creator] Writing env.build/BP_NATIVE_IMAGE_BUILD_ARGUMENTS_FILE.default
[INFO] [creator] Writing env.build/CLASSPATH.append
[INFO] [creator] Writing env.build/CLASSPATH.delim
[INFO] [creator] Image labels:
[INFO] [creator] org.opencontainers.image.title
[INFO] [creator] org.opencontainers.image.version
[INFO] [creator] org.springframework.boot.version
[INFO] [creator] Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Native Image 5.8.0
[INFO] [creator] https://github.com/paketo-buildpacks/native-image
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_BINARY_COMPRESSION_METHOD Compression mechanism used to reduce binary size. Options: `none` (default), `upx` or `gzexe`
[INFO] [creator] $BP_NATIVE_IMAGE true enable native image build
[INFO] [creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS arguments to pass to the native-image command
[INFO] [creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS_FILE /workspace/META-INF/native-image/argfile a file with arguments to pass to the native-image command
[INFO] [creator] $BP_NATIVE_IMAGE_BUILT_ARTIFACT the built application artifact explicitly, required if building from a JAR
[INFO] [creator] Native Image: Contributing to layer
[INFO] [creator] Executing native-image -H:+StaticExecutableWithDynamicLibC #/workspace/META-INF/native-image/argfile -H:Name=/layers/paketo-buildpacks_native-image/native-image/at.wrwks.bef.projektaggregat.ApplicationKt -cp /workspace:/workspace/BOOT-INF/classes:/workspace/BOOT-INF/lib/kotlin-stdlib-1.8.0.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-common-1.8.0.jar:/workspace/BOOT-INF/lib/annotations-13.0.jar:/workspace/BOOT-INF/lib/kotlin-reflect-1.8.0.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-core-1.6.4.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-core-jvm-1.6.4.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-reactor-1.6.4.jar:/workspace/BOOT-INF/lib/reactor-core-3.5.2.jar:/workspace/BOOT-INF/lib/reactive-streams-1.0.4.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-reactive-1.6.4.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-jdk8-1.8.0.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-jdk7-1.8.0.jar:/workspace/BOOT-INF/lib/jackson-module-kotlin-2.14.1.jar:/workspace/BOOT-INF/lib/jackson-databind-2.14.1.jar:/workspace/BOOT-INF/lib/jackson-annotations-2.14.1.jar:/workspace/BOOT-INF/lib/jackson-datatype-jsr310-2.14.1.jar:/workspace/BOOT-INF/lib/jackson-core-2.14.1.jar:/workspace/BOOT-INF/lib/reactor-kotlin-extensions-1.1.7.jar:/workspace/BOOT-INF/lib/spring-boot-3.0.2.jar:/workspace/BOOT-INF/lib/spring-boot-autoconfigure-3.0.2.jar:/workspace/BOOT-INF/lib/log4j-to-slf4j-2.19.0.jar:/workspace/BOOT-INF/lib/log4j-api-2.19.0.jar:/workspace/BOOT-INF/lib/jul-to-slf4j-2.0.6.jar:/workspace/BOOT-INF/lib/jakarta.annotation-api-2.1.1.jar:/workspace/BOOT-INF/lib/spring-core-6.0.4.jar:/workspace/BOOT-INF/lib/spring-jcl-6.0.4.jar:/workspace/BOOT-INF/lib/snakeyaml-1.33.jar:/workspace/BOOT-INF/lib/spring-boot-actuator-autoconfigure-3.0.2.jar:/workspace/BOOT-INF/lib/spring-boot-actuator-3.0.2.jar:/workspace/BOOT-INF/lib/micrometer-observation-1.10.3.jar:/workspace/BOOT-INF/lib/micrometer-commons-1.10.3.jar:/workspace/BOOT-INF/lib/micrometer-core-1.10.3.jar:/workspace/BOOT-INF/lib/HdrHistogram-2.1.12.jar:/workspace/BOOT-INF/lib/LatencyUtils-2.0.3.jar:/workspace/BOOT-INF/lib/jackson-datatype-jdk8-2.14.1.jar:/workspace/BOOT-INF/lib/jackson-module-parameter-names-2.14.1.jar:/workspace/BOOT-INF/lib/reactor-netty-http-1.1.2.jar:/workspace/BOOT-INF/lib/netty-codec-http-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-codec-http2-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-dns-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-codec-dns-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-dns-native-macos-4.1.87.Final-osx-x86_64.jar:/workspace/BOOT-INF/lib/netty-resolver-dns-classes-macos-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-transport-native-epoll-4.1.87.Final-linux-x86_64.jar:/workspace/BOOT-INF/lib/reactor-netty-core-1.1.2.jar:/workspace/BOOT-INF/lib/spring-web-6.0.4.jar:/workspace/BOOT-INF/lib/spring-beans-6.0.4.jar:/workspace/BOOT-INF/lib/spring-webflux-6.0.4.jar:/workspace/BOOT-INF/lib/spring-cloud-stream-4.0.1.jar:/workspace/BOOT-INF/lib/tomcat-embed-el-10.1.5.jar:/workspace/BOOT-INF/lib/hibernate-validator-8.0.0.Final.jar:/workspace/BOOT-INF/lib/jakarta.validation-api-3.0.2.jar:/workspace/BOOT-INF/lib/jboss-logging-3.5.0.Final.jar:/workspace/BOOT-INF/lib/classmate-1.5.1.jar:/workspace/BOOT-INF/lib/spring-messaging-6.0.4.jar:/workspace/BOOT-INF/lib/spring-integration-core-6.0.2.jar:/workspace/BOOT-INF/lib/spring-tx-6.0.4.jar:/workspace/BOOT-INF/lib/spring-integration-jmx-6.0.2.jar:/workspace/BOOT-INF/lib/spring-retry-2.0.0.jar:/workspace/BOOT-INF/lib/spring-cloud-function-context-4.0.1.jar:/workspace/BOOT-INF/lib/typetools-0.6.2.jar:/workspace/BOOT-INF/lib/spring-cloud-function-core-4.0.1.jar:/workspace/BOOT-INF/lib/javax.annotation-api-1.3.2.jar:/workspace/BOOT-INF/lib/javax.activation-api-1.2.0.jar:/workspace/BOOT-INF/lib/spring-cloud-stream-binder-kafka-4.0.1.jar:/workspace/BOOT-INF/lib/spring-cloud-stream-binder-kafka-core-4.0.1.jar:/workspace/BOOT-INF/lib/spring-integration-kafka-6.0.2.jar:/workspace/BOOT-INF/lib/spring-kafka-3.0.2.jar:/workspace/BOOT-INF/lib/spring-cloud-stream-binder-kafka-streams-4.0.1.jar:/workspace/BOOT-INF/lib/kafka-streams-3.3.2.jar:/workspace/BOOT-INF/lib/rocksdbjni-7.1.2.jar:/workspace/BOOT-INF/lib/micrometer-registry-prometheus-1.10.3.jar:/workspace/BOOT-INF/lib/simpleclient_common-0.16.0.jar:/workspace/BOOT-INF/lib/simpleclient-0.16.0.jar:/workspace/BOOT-INF/lib/simpleclient_tracer_otel-0.16.0.jar:/workspace/BOOT-INF/lib/simpleclient_tracer_common-0.16.0.jar:/workspace/BOOT-INF/lib/simpleclient_tracer_otel_agent-0.16.0.jar:/workspace/BOOT-INF/lib/spring-aop-6.0.4.jar:/workspace/BOOT-INF/lib/spring-security-config-6.0.1.jar:/workspace/BOOT-INF/lib/spring-security-web-6.0.1.jar:/workspace/BOOT-INF/lib/spring-expression-6.0.4.jar:/workspace/BOOT-INF/lib/spring-security-oauth2-jose-6.0.1.jar:/workspace/BOOT-INF/lib/spring-security-core-6.0.1.jar:/workspace/BOOT-INF/lib/spring-security-crypto-6.0.1.jar:/workspace/BOOT-INF/lib/spring-security-oauth2-core-6.0.1.jar:/workspace/BOOT-INF/lib/nimbus-jose-jwt-9.24.4.jar:/workspace/BOOT-INF/lib/jcip-annotations-1.0-1.jar:/workspace/BOOT-INF/lib/spring-security-oauth2-resource-server-6.0.1.jar:/workspace/BOOT-INF/lib/sentry-logback-6.11.0.jar:/workspace/BOOT-INF/lib/sentry-6.11.0.jar:/workspace/BOOT-INF/lib/logback-classic-1.4.5.jar:/workspace/BOOT-INF/lib/logback-core-1.4.5.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-test-1.6.4.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-test-jvm-1.6.4.jar:/workspace/BOOT-INF/lib/spring-context-6.0.4.jar:/workspace/BOOT-INF/lib/netty-handler-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-common-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-buffer-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-transport-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-transport-native-unix-common-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-codec-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-transport-classes-epoll-4.1.87.Final.jar:/workspace/BOOT-INF/lib/zstd-jni-1.5.2-1.jar:/workspace/BOOT-INF/lib/lz4-java-1.8.0.jar:/workspace/BOOT-INF/lib/snappy-java-1.1.8.4.jar:/workspace/BOOT-INF/lib/jsr305-3.0.2.jar:/workspace/BOOT-INF/lib/kafka-clients-3.3.2.jar:/workspace/BOOT-INF/lib/slf4j-api-2.0.6.jar:/workspace/BOOT-INF/lib/netty-handler-proxy-4.1.87.Final.jar:/workspace/BOOT-INF/lib/netty-codec-socks-4.1.87.Final.jar:/workspace/BOOT-INF/lib/spring-boot-jarmode-layertools-3.0.2.jar at.wrwks.bef.projektaggregat.ApplicationKt

spring-boot:build-image gets stuck

I want to test the new native-build feature of the spring boot 3.0 release. I am following this tutorial [here][1].
I installed jdk java 22.3.r17-nik via sdkman.
I ran $ mvn -Pnative spring-boot:build-image. The process starts but then always get stuck.
This is the log:
[INFO]
[INFO] -----------------------< com.example:myproject >------------------------
[INFO] Building myproject 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:3.0.0:build-image (default-cli) > package # myproject >>>
[INFO]
[INFO] --- maven-resources-plugin:3.3.0:resources (default-resources) # myproject ---
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) # myproject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.3.0:testResources (default-testResources) # myproject ---
[INFO] skip non existing resourceDirectory /Users/klaaspelzer/Projects/boot3/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) # myproject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # myproject ---
[INFO]
[INFO] --- maven-jar-plugin:3.3.0:jar (default-jar) # myproject ---
[INFO] Building jar: /Users/klaaspelzer/Projects/boot3/target/myproject-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] <<< spring-boot-maven-plugin:3.0.0:build-image (default-cli) < package # myproject <<<
[INFO]
[INFO]
[INFO] --- spring-boot-maven-plugin:3.0.0:build-image (default-cli) # myproject ---
[INFO] Building image 'docker.io/library/myproject:0.0.1-SNAPSHOT'
[INFO]
[INFO] > Pulling builder image 'docker.io/paketobuildpacks/builder:tiny' 100%
[INFO] > Pulled builder image 'paketobuildpacks/builder#sha256:850b2b3dd3eab7bacfe33839712c67c3cb50431aff4ff36c435b3d97ea927268'
[INFO] > Pulling run image 'docker.io/paketobuildpacks/run:tiny-cnb' 100%
[INFO] > Pulled run image 'paketobuildpacks/run#sha256:c6b81e85b32036dab113dc33454eaa29c006c252bb48a87bf623a635c1763ce6'
[INFO] > Executing lifecycle version v0.15.1
[INFO] > Using build cache volume 'pack-cache-eed8708d57f5.build'
[INFO]
[INFO] > Running creator
[INFO] [creator] ===> ANALYZING
[INFO] [creator] Previous image with name "docker.io/library/myproject:0.0.1-SNAPSHOT" not found
[INFO] [creator] ===> DETECTING
[INFO] [creator] 6 of 14 buildpacks participating
[INFO] [creator] paketo-buildpacks/ca-certificates 3.5.0
[INFO] [creator] paketo-buildpacks/bellsoft-liberica 9.10.0
[INFO] [creator] paketo-buildpacks/syft 1.22.1
[INFO] [creator] paketo-buildpacks/executable-jar 6.5.0
[INFO] [creator] paketo-buildpacks/spring-boot 5.20.0
[INFO] [creator] paketo-buildpacks/native-image 5.6.0
[INFO] [creator] ===> RESTORING
[INFO] [creator] ===> BUILDING
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for CA Certificates 3.5.0
[INFO] [creator] https://github.com/paketo-buildpacks/ca-certificates
[INFO] [creator] Launch Helper: Contributing to layer
[INFO] [creator] Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for BellSoft Liberica 9.10.0
[INFO] [creator] https://github.com/paketo-buildpacks/bellsoft-liberica
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_JVM_JLINK_ARGS --no-man-pages --no-header-files --strip-debug --compress=1 configure custom link arguments (--output must be omitted)
[INFO] [creator] $BP_JVM_JLINK_ENABLED false enables running jlink tool to generate custom JRE
[INFO] [creator] $BP_JVM_TYPE JRE the JVM type - JDK or JRE
[INFO] [creator] $BP_JVM_VERSION 11 the Java version
[INFO] [creator] Launch Configuration:
[INFO] [creator] $BPL_DEBUG_ENABLED false enables Java remote debugging support
[INFO] [creator] $BPL_DEBUG_PORT 8000 configure the remote debugging port
[INFO] [creator] $BPL_DEBUG_SUSPEND false configure whether to suspend execution until a debugger has attached
[INFO] [creator] $BPL_HEAP_DUMP_PATH write heap dumps on error to this path
[INFO] [creator] $BPL_JAVA_NMT_ENABLED true enables Java Native Memory Tracking (NMT)
[INFO] [creator] $BPL_JAVA_NMT_LEVEL summary configure level of NMT, summary or detail
[INFO] [creator] $BPL_JFR_ARGS configure custom Java Flight Recording (JFR) arguments
[INFO] [creator] $BPL_JFR_ENABLED false enables Java Flight Recording (JFR)
[INFO] [creator] $BPL_JMX_ENABLED false enables Java Management Extensions (JMX)
[INFO] [creator] $BPL_JMX_PORT 5000 configure the JMX port
[INFO] [creator] $BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation
[INFO] [creator] $BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation
[INFO] [creator] $BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
[INFO] [creator] $JAVA_TOOL_OPTIONS the JVM launch flags
[INFO] [creator] Using Java version 17 extracted from MANIFEST.MF
[INFO] [creator] BellSoft Liberica NIK 17.0.5: Contributing to layer
[INFO] [creator] Downloading from https://download.bell-sw.com/vm/22.3.0/bellsoft-liberica-vm-core-openjdk17.0.5+8-22.3.0+2-linux-amd64.tar.gz
[INFO] [creator] Verifying checksum
[INFO] [creator] Expanding to /layers/paketo-buildpacks_bellsoft-liberica/native-image-svm
[INFO] [creator] Adding 127 container CA certificates to JVM truststore
[INFO] [creator] Writing env.build/JAVA_HOME.override
[INFO] [creator] Writing env.build/JDK_HOME.override
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Syft 1.22.1
[INFO] [creator] https://github.com/paketo-buildpacks/syft
[INFO] [creator] Downloading from https://github.com/anchore/syft/releases/download/v0.60.3/syft_0.60.3_linux_amd64.tar.gz
[INFO] [creator] Verifying checksum
[INFO] [creator] Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Executable JAR 6.5.0
[INFO] [creator] https://github.com/paketo-buildpacks/executable-jar
[INFO] [creator] Class Path: Contributing to layer
[INFO] [creator] Writing env.build/CLASSPATH.delim
[INFO] [creator] Writing env.build/CLASSPATH.prepend
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Spring Boot 5.20.0
[INFO] [creator] https://github.com/paketo-buildpacks/spring-boot
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_SPRING_CLOUD_BINDINGS_DISABLED false whether to contribute Spring Boot cloud bindings support
[INFO] [creator] Launch Configuration:
[INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_DISABLED false whether to auto-configure Spring Boot environment properties from bindings
[INFO] [creator] $BPL_SPRING_CLOUD_BINDINGS_ENABLED true Deprecated - whether to auto-configure Spring Boot environment properties from bindings
[INFO] [creator] Class Path: Contributing to layer
[INFO] [creator] Writing env.build/CLASSPATH.append
[INFO] [creator] Writing env.build/CLASSPATH.delim
[INFO] [creator] Image labels:
[INFO] [creator] org.opencontainers.image.title
[INFO] [creator] org.opencontainers.image.version
[INFO] [creator] org.springframework.boot.version
[INFO] [creator] Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Native Image 5.6.0
[INFO] [creator] https://github.com/paketo-buildpacks/native-image
[INFO] [creator] Build Configuration:
[INFO] [creator] $BP_BINARY_COMPRESSION_METHOD Compression mechanism used to reduce binary size. Options: `none` (default), `upx` or `gzexe`
[INFO] [creator] $BP_NATIVE_IMAGE true enable native image build
[INFO] [creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS arguments to pass to the native-image command
[INFO] [creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS_FILE a file with arguments to pass to the native-image command
[INFO] [creator] $BP_NATIVE_IMAGE_BUILT_ARTIFACT the built application artifact explicitly, required if building from a JAR
[INFO] [creator] Native Image: Contributing to layer
[INFO] [creator] Executing native-image -H:+StaticExecutableWithDynamicLibC -H:Name=/layers/paketo-buildpacks_native-image/native-image/com.example.boot3.MyApplication -cp /workspace:/workspace/BOOT-INF/classes:/workspace/BOOT-INF/lib/spring-boot-3.0.0.jar:/workspace/BOOT-INF/lib/spring-boot-autoconfigure-3.0.0.jar:/workspace/BOOT-INF/lib/logback-classic-1.4.5.jar:/workspace/BOOT-INF/lib/logback-core-1.4.5.jar:/workspace/BOOT-INF/lib/slf4j-api-2.0.4.jar:/workspace/BOOT-INF/lib/log4j-to-slf4j-2.19.0.jar:/workspace/BOOT-INF/lib/log4j-api-2.19.0.jar:/workspace/BOOT-INF/lib/jul-to-slf4j-2.0.4.jar:/workspace/BOOT-INF/lib/jakarta.annotation-api-2.1.1.jar:/workspace/BOOT-INF/lib/spring-core-6.0.2.jar:/workspace/BOOT-INF/lib/spring-jcl-6.0.2.jar:/workspace/BOOT-INF/lib/snakeyaml-1.33.jar:/workspace/BOOT-INF/lib/jackson-databind-2.14.1.jar:/workspace/BOOT-INF/lib/jackson-annotations-2.14.1.jar:/workspace/BOOT-INF/lib/jackson-core-2.14.1.jar:/workspace/BOOT-INF/lib/jackson-datatype-jdk8-2.14.1.jar:/workspace/BOOT-INF/lib/jackson-datatype-jsr310-2.14.1.jar:/workspace/BOOT-INF/lib/jackson-module-parameter-names-2.14.1.jar:/workspace/BOOT-INF/lib/tomcat-embed-core-10.1.1.jar:/workspace/BOOT-INF/lib/tomcat-embed-el-10.1.1.jar:/workspace/BOOT-INF/lib/tomcat-embed-websocket-10.1.1.jar:/workspace/BOOT-INF/lib/spring-web-6.0.2.jar:/workspace/BOOT-INF/lib/spring-beans-6.0.2.jar:/workspace/BOOT-INF/lib/micrometer-observation-1.10.2.jar:/workspace/BOOT-INF/lib/micrometer-commons-1.10.2.jar:/workspace/BOOT-INF/lib/spring-webmvc-6.0.2.jar:/workspace/BOOT-INF/lib/spring-aop-6.0.2.jar:/workspace/BOOT-INF/lib/spring-context-6.0.2.jar:/workspace/BOOT-INF/lib/spring-expression-6.0.2.jar:/workspace/BOOT-INF/lib/spring-boot-jarmode-layertools-3.0.0.jar com.example.boot3.MyApplication
[INFO] [creator] ================================================================================
[INFO] [creator] GraalVM Native Image: Generating '/layers/paketo-buildpacks_native-image/native-image/com.example.boot3.MyApplication' (static executable)...
[INFO] [creator] ================================================================================
[INFO] [creator] [1/7] Initializing... (39.3s # 0.16GB)
[INFO] [creator] Version info: 'GraalVM 22.3.0 Java 17 CE'
[INFO] [creator] Java version info: '17.0.5+8-LTS'
[INFO] [creator] C compiler: gcc (linux, x86_64, 7.5.0)
[INFO] [creator] Garbage collector: Serial GC
[INFO] [creator] 1 user-specific feature(s)
[INFO] [creator] - org.springframework.aot.nativex.feature.PreComputeFieldFeature
[INFO] [creator] The bundle named: org.apache.el.Messages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
[INFO] [creator]
[INFO] [creator] === Image generator watchdog detected no activity. This can be a sign of a deadlock during image building. Dumping all stack traces. Current time: Thu Nov 24 21:38:08 UTC 2022
I ran it multiple times and updated docker. I am using a macbook pro with m1 chip.
Docker is allowed to use 10 GB and 5 cores but is barely using 300mb RAM.
my pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>myproject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.0</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>
my main:
package com.example.boot3;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
#RestController
#SpringBootApplication
public class MyApplication {
#RequestMapping("/")
String home() {
return "Hello World!";
}
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}
EDIT:
I reinstalled docker, now the process went further but stuck again.
New logs:
[INFO] [creator] [1/7] Initializing... (39.7s # 0.16GB)
[INFO] [creator] Version info: 'GraalVM 22.3.0 Java 17 CE'
[INFO] [creator] Java version info: '17.0.5+8-LTS'
[INFO] [creator] C compiler: gcc (linux, x86_64, 7.5.0)
[INFO] [creator] Garbage collector: Serial GC
[INFO] [creator] 1 user-specific feature(s)
[INFO] [creator] - org.springframework.aot.nativex.feature.PreComputeFieldFeature
[INFO] [creator] The bundle named: org.apache.el.Messages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
[INFO] [creator] Field org.springframework.core.NativeDetector#imageCode set to true at build time
[INFO] [creator] Field org.apache.commons.logging.LogAdapter#log4jSpiPresent set to true at build time
[INFO] [creator] Field org.apache.commons.logging.LogAdapter#log4jSlf4jProviderPresent set to true at build time
[INFO] [creator] Field org.apache.commons.logging.LogAdapter#slf4jSpiPresent set to true at build time
[INFO] [creator] Field org.apache.commons.logging.LogAdapter#slf4jApiPresent set to true at build time
[INFO] [creator] Field org.springframework.format.support.DefaultFormattingConversionService#jsr354Present set to false at build time
[INFO] [creator] Field org.springframework.core.KotlinDetector#kotlinPresent set to false at build time
[INFO] [creator] Field org.springframework.core.KotlinDetector#kotlinReflectPresent set to false at build time
[INFO] [creator] Field org.springframework.cglib.core.AbstractClassGenerator#imageCode set to true at build time
[INFO] [creator] [2/7] Performing analysis... [**********] (337.7s # 1.82GB)
[INFO] [creator] 10,223 (89.53%) of 11,418 classes reachable
[INFO] [creator] 16,614 (63.36%) of 26,220 fields reachable
[INFO] [creator] 48,428 (58.34%) of 83,017 methods reachable
[INFO] [creator] 466 classes, 138 fields, and 2,281 methods registered for reflection
[INFO] [creator] 63 classes, 68 fields, and 55 methods registered for JNI access
[INFO] [creator] 4 native libraries: dl, pthread, rt, z
[INFO] [creator] [3/7] Building universe... (26.5s # 2.12GB)
[INFO] [creator]
[INFO] [creator] Warning: Dynamic proxy method java.lang.reflect.Proxy.newProxyInstance invoked at org.springframework.core.annotation.SynthesizedMergedAnnotationInvocationHandler.createProxy(SynthesizedMergedAnnotationInvocationHandler.java:304)
[INFO] [creator] Warning: Dynamic proxy method java.lang.reflect.Proxy.newProxyInstance invoked at org.springframework.core.io.support.VfsPatternUtils.visit(VfsPatternUtils.java:51)
[INFO] [creator] Warning: Dynamic proxy method java.lang.reflect.Proxy.newProxyInstance invoked at org.springframework.beans.factory.support.AutowireUtils.resolveAutowiringValue(AutowireUtils.java:134)
[INFO] [creator] Warning: Aborting stand-alone image build due to dynamic proxy use without configuration.
[INFO] [creator] Warning: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
[INFO] [creator] --------------------------------------------------------------------------------
[INFO] [creator] 12.8s (3.1% of total time) in 29 GCs | Peak RSS: 3.50GB | CPU load: 3.38
[INFO] [creator] ================================================================================
[INFO] [creator] Failed generating '/layers/paketo-buildpacks_native-image/native-image/com.example.boot3.MyApplication' after 6m 46s.
[INFO] [creator] Generating fallback image...
It says it failed to generating the image. Weird?
[1]: https://docs.spring.io/spring-boot/docs/3.0.0-SNAPSHOT/reference/html/native-image.html#native-image

Issue in Building a Docker Image with Maven

I m trying to build docker image for springboot project using below command ,
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=myorg/myapp
error ,
[INFO] > Using build cache volume 'pack-cache-152f93393a7f.build'
[INFO]
[INFO] > Running creator
[INFO] [creator] Previous image with name "myorg/myapp:latest" not found
[INFO] [creator] ===> DETECTING
[INFO] [creator] qemu: uncaught target signal 11 (Segmentation fault) - core dumped
My machine details are:
macOsBigSur
Version - 11.2.2
Chip - Apple M1
RAM - 16 GB
Any suggestions ?

Create Image with Spring-Native, having problem with Paketo Syft Buildpack 1.11.2

I am having issue building image with Spring-Native, using OpenJdk 11.
ProblemSatement:
When I am running $ mvn clean package spring-boot:build-image -DskipTests command, i am not able to proceed after at Paketo Syft Buildpack 1.11.2. Sharing the log below :
.> [INFO] > Running creator [INFO] [creator] Previous image with
name "docker.io/library/rest-service-complete:0.0.1-SNAPSHOT" not
found [INFO] [creator] ===> DETECTING [INFO] [creator]
6 of 14 buildpacks participating [INFO] [creator]
paketo-buildpacks/ca-certificates 3.2.3 [INFO] [creator]
paketo-buildpacks/bellsoft-liberica 9.3.5 [INFO] [creator]
paketo-buildpacks/syft 1.11.2 [INFO] [creator]
paketo-buildpacks/executable-jar 6.2.4 [INFO] [creator]
paketo-buildpacks/spring-boot 5.11.0 [INFO] [creator]
paketo-buildpacks/native-image 5.2.3 [INFO] [creator]
===> RESTORING [INFO] [creator] ===> BUILDING [INFO] [creator] [INFO] [creator] Paketo CA Certificates Buildpack
3.2.3 [INFO] [creator] https://github.com/paketo-buildpacks/ca-certificates [INFO]
[creator] Launch Helper: Contributing to layer [INFO]
[creator] Creating
/layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[INFO] [creator] [INFO] [creator] Paketo BellSoft Liberica
Buildpack 9.3.5 [INFO] [creator]
https://github.com/paketo-buildpacks/bellsoft-liberica [INFO]
[creator] Build Configuration: [INFO] [creator]
$BP_JVM_TYPE JRE the JVM type - JDK or JRE
[INFO] [creator] $BP_JVM_VERSION 11.*
the Java version . . . . [INFO] [creator] Using Java
version 11.* from BP_JVM_VERSION [INFO] [creator] BellSoft
Liberica NIK 11.0.15: Contributing to layer [INFO] [creator]
Downloading from
https://download.bell-sw.com/vm/22.1.0/bellsoft-liberica-vm-core-openjdk11.0.15+10-22.1.0+1-linux-amd64.tar.gz
[INFO] [creator] Verifying checksum [INFO] [creator]
Expanding to
/layers/paketo-buildpacks_bellsoft-liberica/native-image-svm [INFO]
[creator] Adding 127 container CA certificates to JVM
truststore [INFO] [creator] Writing
env.build/JAVA_HOME.override [INFO] [creator] Writing
env.build/JDK_HOME.override [INFO] [creator] [INFO] [creator]
Paketo Syft Buildpack 1.11.2 [INFO] [creator]
https://github.com/paketo-buildpacks/syft [INFO] [creator]
Downloading from
https://github.com/anchore/syft/releases/download/v0.46.2/syft_0.46.2_linux_amd64.tar.gz
[INFO] [creator] unable to invoke layer creator [INFO]
[creator] unable to get dependency syft [INFO] [creator]
unable to download
https://github.com/anchore/syft/releases/download/v0.46.2/syft_0.46.2_linux_amd64.tar.gz
[INFO] [creator] unable to request
https://github.com/anchore/syft/releases/download/v0.46.2/syft_0.46.2_linux_amd64.tar.gz
[INFO] [creator] Get
"https://github.com/anchore/syft/releases/download/v0.46.2/syft_0.46.2_linux_amd64.tar.gz":
x509: certificate signed by unknown authority [INFO] [creator]
ERROR: failed to build: exit status 1 [INFO]
------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Total time: 01:23 min [INFO] Finished at:
2022-07-01T15:45:36-05:00 [INFO]
------------------------------------------------------------------------ [ERROR] Failed to execute goal
org.springframework.boot:spring-boot-maven-plugin:2.7.0:build-image
(default-cli) on project rest-service-complete: Execution default-cli
of goal
org.springframework.boot:spring-boot-maven-plugin:2.7.0:build-image
failed: Builder lifecycle 'creator'

`#PreAuthorize` with spring-native triggers packaging error: `repeated interface: org.springframework.aop.SpringProxy`

I'm trying to build native images for spring-boot apps in a maven multi-module project.
As soon as I decorate a #Controller method with #PreAuthorize, native image generation fail with the message below.
Following spring-native samples, I tryed both with (as done in security-method-class-proxies) and without (as done in security-method) #AotProxyHint on application class, but this made no difference.
The error:
[INFO] [creator] Error: Error parsing dynamic proxy configuration in file:/workspace/META-INF/native-image/org.springframework.aot/spring-aot/proxy-config.json:
[INFO] [creator] java.lang.IllegalArgumentException: repeated interface: org.springframework.aop.SpringProxy
[INFO] [creator] Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option DynamicProxyConfigurationResources.
[INFO] [creator] Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
[INFO] [creator] Error: Image build request failed with exit status 1
[INFO] [creator] unable to invoke layer creator
[INFO] [creator] unable to contribute native-image layer
[INFO] [creator] error running build
[INFO] [creator] exit status 1
[INFO] [creator] ERROR: failed to build: exit status 1
Any clue why?
I figured out two things about this error:
as soon as #PreAuthorize targets a class member (not an interface), configuration must provide an #AotProxyHint(targetClass = ..., proxyFeatures = ProxyBits.IS_STATIC) for this class
there is bug on Windows about that declared in spring-native issues

Resources