Issue:
Spring boot 3.0 bootBuildImage task takes too long/is stuck. I waited for >3hours before canceling it. There is no error message.
Please note that I had to add a root cert to the build config because I am behind a company proxy that uses a root ca.
Relevant information:
Versions
./gradlew --version
------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------
Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 17.0.5 (GraalVM Community 17.0.5+8-jvmci-22.3-b08)
OS: Mac OS X 12.6 aarch64
build.gradle.kts:
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "3.0.0"
id("io.spring.dependency-management") version "1.1.0"
id("org.graalvm.buildtools.native") version "0.9.18"
kotlin("jvm") version "1.7.21"
kotlin("plugin.spring") version "1.7.21"
}
group = "org.dripto"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_17
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks {
bootBuildImage {
builder.set("paketobuildpacks/builder:tiny")
bindings.add(
"$rootDir/bindings/certificates:/platform/bindings/ca-certificates"
)
environment.put("BP_NATIVE_IMAGE", "true")
}
}
build log:
./gradlew bootBuildImage ─╯
Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --status for details
> Task :bootBuildImage
Building image 'docker.io/library/spring3-native:0.0.1-SNAPSHOT'
> Pulling builder image 'docker.io/paketobuildpacks/builder:tiny' ..................................................
> Pulled builder image 'paketobuildpacks/builder@sha256:850b2b3dd3eab7bacfe33839712c67c3cb50431aff4ff36c435b3d97ea927268'
> Pulling run image 'docker.io/paketobuildpacks/run:tiny-cnb' ..................................................
> Pulled run image 'paketobuildpacks/run@sha256:c6b81e85b32036dab113dc33454eaa29c006c252bb48a87bf623a635c1763ce6'
> Executing lifecycle version v0.15.1
> Using build cache volume 'pack-cache-dfc424b90e1a.build'
> Running creator
[creator] ===> ANALYZING
[creator] Previous image with name "docker.io/library/spring3-native:0.0.1-SNAPSHOT" not found
[creator] ===> DETECTING
[creator] 6 of 14 buildpacks participating
[creator] paketo-buildpacks/ca-certificates 3.5.0
[creator] paketo-buildpacks/bellsoft-liberica 9.10.0
[creator] paketo-buildpacks/syft 1.22.1
[creator] paketo-buildpacks/executable-jar 6.5.0
[creator] paketo-buildpacks/spring-boot 5.20.0
[creator] paketo-buildpacks/native-image 5.6.0
[creator] ===> RESTORING
[creator] ===> BUILDING
[creator]
[creator] Paketo Buildpack for CA Certificates 3.5.0
[creator] https://github.com/paketo-buildpacks/ca-certificates
[creator] Launch Helper: Contributing to layer
[creator] Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
[creator] CA Certificates: Contributing to layer
[creator] Added 2 additional CA certificate(s) to system truststore
[creator] Writing env.build/SSL_CERT_DIR.append
[creator] Writing env.build/SSL_CERT_DIR.delim
[creator] Writing env.build/SSL_CERT_FILE.default
[creator]
[creator] Paketo Buildpack for BellSoft Liberica 9.10.0
[creator] https://github.com/paketo-buildpacks/bellsoft-liberica
[creator] Build Configuration:
[creator] $BP_JVM_JLINK_ARGS --no-man-pages --no-header-files --strip-debug --compress=1 configure custom link arguments (--output must be omitted)
[creator] $BP_JVM_JLINK_ENABLED false enables running jlink tool to generate custom JRE
[creator] $BP_JVM_TYPE JRE the JVM type - JDK or JRE
[creator] $BP_JVM_VERSION 11 the Java version
[creator] Launch Configuration:
[creator] $BPL_DEBUG_ENABLED false enables Java remote debugging support
[creator] $BPL_DEBUG_PORT 8000 configure the remote debugging port
[creator] $BPL_DEBUG_SUSPEND false configure whether to suspend execution until a debugger has attached
[creator] $BPL_HEAP_DUMP_PATH write heap dumps on error to this path
[creator] $BPL_JAVA_NMT_ENABLED true enables Java Native Memory Tracking (NMT)
[creator] $BPL_JAVA_NMT_LEVEL summary configure level of NMT, summary or detail
[creator] $BPL_JFR_ARGS configure custom Java Flight Recording (JFR) arguments
[creator] $BPL_JFR_ENABLED false enables Java Flight Recording (JFR)
[creator] $BPL_JMX_ENABLED false enables Java Management Extensions (JMX)
[creator] $BPL_JMX_PORT 5000 configure the JMX port
[creator] $BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation
[creator] $BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation
[creator] $BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
[creator] $JAVA_TOOL_OPTIONS the JVM launch flags
[creator] Using Java version 17 extracted from MANIFEST.MF
[creator] BellSoft Liberica NIK 17.0.5: Contributing to layer
[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
[creator] Verifying checksum
[creator] Expanding to /layers/paketo-buildpacks_bellsoft-liberica/native-image-svm
[creator] Adding 129 container CA certificates to JVM truststore
[creator] Writing env.build/JAVA_HOME.override
[creator] Writing env.build/JDK_HOME.override
[creator]
[creator] Paketo Buildpack for Syft 1.22.1
[creator] https://github.com/paketo-buildpacks/syft
[creator] Downloading from https://github.com/anchore/syft/releases/download/v0.60.3/syft_0.60.3_linux_amd64.tar.gz
[creator] Verifying checksum
[creator] Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default
[creator]
[creator] Paketo Buildpack for Executable JAR 6.5.0
[creator] https://github.com/paketo-buildpacks/executable-jar
[creator] Class Path: Contributing to layer
[creator] Writing env.build/CLASSPATH.delim
[creator] Writing env.build/CLASSPATH.prepend
[creator]
[creator] Paketo Buildpack for Spring Boot 5.20.0
[creator] https://github.com/paketo-buildpacks/spring-boot
[creator] Build Configuration:
[creator] $BP_SPRING_CLOUD_BINDINGS_DISABLED false whether to contribute Spring Boot cloud bindings support
[creator] Launch Configuration:
[creator] $BPL_SPRING_CLOUD_BINDINGS_DISABLED false whether to auto-configure Spring Boot environment properties from bindings
[creator] $BPL_SPRING_CLOUD_BINDINGS_ENABLED true Deprecated - whether to auto-configure Spring Boot environment properties from bindings
[creator] Class Path: Contributing to layer
[creator] native args file /workspace/META-INF/native-image/argfile
[creator] Writing env.build/BP_NATIVE_IMAGE_BUILD_ARGUMENTS_FILE.default
[creator] Writing env.build/CLASSPATH.append
[creator] Writing env.build/CLASSPATH.delim
[creator] Image labels:
[creator] org.springframework.boot.version
[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>.
[creator]
[creator] Paketo Buildpack for Native Image 5.6.0
[creator] https://github.com/paketo-buildpacks/native-image
[creator] Build Configuration:
[creator] $BP_BINARY_COMPRESSION_METHOD Compression mechanism used to reduce binary size. Options: `none` (default), `upx` or `gzexe`
[creator] $BP_NATIVE_IMAGE true enable native image build
[creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS arguments to pass to the native-image command
[creator] $BP_NATIVE_IMAGE_BUILD_ARGUMENTS_FILE /workspace/META-INF/native-image/argfile a file with arguments to pass to the native-image command
[creator] $BP_NATIVE_IMAGE_BUILT_ARTIFACT the built application artifact explicitly, required if building from a JAR
[creator] Native Image: Contributing to layer
[creator] Executing native-image -H:+StaticExecutableWithDynamicLibC @/workspace/META-INF/native-image/argfile -H:Name=/layers/paketo-buildpacks_native-image/native-image/org.dripto.spring3native.Spring3NativeApplicationKt -cp /workspace:/workspace/BOOT-INF/classes:/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/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-module-kotlin-2.14.1.jar:/workspace/BOOT-INF/lib/kotlin-reflect-1.7.21.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-jdk8-1.7.21.jar:/workspace/BOOT-INF/lib/spring-webmvc-6.0.2.jar:/workspace/BOOT-INF/lib/spring-web-6.0.2.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-jdk7-1.7.21.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-1.7.21.jar:/workspace/BOOT-INF/lib/spring-boot-autoconfigure-3.0.0.jar:/workspace/BOOT-INF/lib/spring-boot-3.0.0.jar:/workspace/BOOT-INF/lib/jakarta.annotation-api-2.1.1.jar:/workspace/BOOT-INF/lib/spring-context-6.0.2.jar:/workspace/BOOT-INF/lib/spring-aop-6.0.2.jar:/workspace/BOOT-INF/lib/spring-beans-6.0.2.jar:/workspace/BOOT-INF/lib/spring-expression-6.0.2.jar:/workspace/BOOT-INF/lib/spring-core-6.0.2.jar:/workspace/BOOT-INF/lib/snakeyaml-1.33.jar:/workspace/BOOT-INF/lib/tomcat-embed-websocket-10.1.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/micrometer-observation-1.10.2.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-common-1.7.21.jar:/workspace/BOOT-INF/lib/annotations-13.0.jar:/workspace/BOOT-INF/lib/logback-classic-1.4.5.jar:/workspace/BOOT-INF/lib/log4j-to-slf4j-2.19.0.jar:/workspace/BOOT-INF/lib/jul-to-slf4j-2.0.4.jar:/workspace/BOOT-INF/lib/spring-jcl-6.0.2.jar:/workspace/BOOT-INF/lib/micrometer-commons-1.10.2.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-api-2.19.0.jar org.dripto.spring3native.Spring3NativeApplicationKt
[creator] ================================================================================
[creator] GraalVM Native Image: Generating '/layers/paketo-buildpacks_native-image/native-image/org.dripto.spring3native.Spring3NativeApplicationKt' (static executable)...
[creator] ================================================================================
[creator] [1/7] Initializing... (71.7s @ 0.29GB)
[creator] Version info: 'GraalVM 22.3.0 Java 17 CE'
[creator] Java version info: '17.0.5+8-LTS'
[creator] C compiler: gcc (linux, x86_64, 7.5.0)
[creator] Garbage collector: Serial GC
[creator] 1 user-specific feature(s)
[creator] - org.springframework.aot.nativex.feature.PreComputeFieldFeature
[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.
[creator] Field org.springframework.core.NativeDetector#imageCode set to true at build time
[creator] Field org.apache.commons.logging.LogAdapter#log4jSpiPresent set to true at build time
[creator] Field org.apache.commons.logging.LogAdapter#log4jSlf4jProviderPresent set to true at build time
[creator] Field org.apache.commons.logging.LogAdapter#slf4jSpiPresent set to true at build time
[creator] Field org.apache.commons.logging.LogAdapter#slf4jApiPresent set to true at build time
[creator] Field org.springframework.format.support.DefaultFormattingConversionService#jsr354Present set to false at build time
[creator] Field org.springframework.core.KotlinDetector#kotlinPresent set to true at build time
[creator] Field org.springframework.core.KotlinDetector#kotlinReflectPresent set to true at build time
[creator] Field org.springframework.cglib.core.AbstractClassGenerator#imageCode set to true at build time
[creator] Field org.springframework.boot.logging.log4j2.Log4J2LoggingSystem$Factory#PRESENT set to false at build time
[creator] Field org.springframework.boot.logging.java.JavaLoggingSystem$Factory#PRESENT set to true at build time
[creator] Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#romePresent set to false at build time
[creator] Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jaxb2Present set to false at build time
[creator] Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jackson2Present set to true at build time
[creator] Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jackson2XmlPresent set to false at build time
[creator] Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jackson2SmilePresent set to false at build time
[creator] Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jackson2CborPresent set to false at build time
[creator] Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#gsonPresent set to false at build time
[creator] Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#jsonbPresent set to false at build time
[creator] Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#kotlinSerializationCborPresent set to false at build time
[creator] Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#kotlinSerializationJsonPresent set to false at build time
[creator] Field org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport#kotlinSerializationProtobufPresent set to false at build time
[creator] Field org.springframework.boot.logging.logback.LogbackLoggingSystem$Factory#PRESENT set to true at build time
<============-> 93% EXECUTING [3h 11m 30s]
> :bootBuildImage
Comment From: wilkinsona
Buildpacks do not yet officially support building native images on aarch64: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-with-GraalVM#building-container-images.