There appears to be a bug when building a project using Corretto, Maven, and ARM64. Based on the error message it is likely a PATH issue in the Corretto installation. If I switch back to AMD64 the problem goes away. It also goes away if I switch off of Corretto.
Expected Behavior
The project successfully builds with pack
Current Behavior
The Maven layer fails because it cannot find javac.
Paketo Buildpack for Maven 6.17.3
unable to create application layer
failed to generate expected metadata
unable to determine java version
error executing 'javac -version':
Combined Output: :
unable to start PTY
fork/exec /layers/paketo-buildpacks_amazon-corretto/jdk/bin/javac: no such file or directory
Log output is below. This error does not happen when using AMD64.
...
Running build for buildpack paketo-buildpacks/amazon-corretto@8.5.1
Looking up buildpack
2024/07/01 13:35:45.360959 Finding plan
2024/07/01 13:35:45.360992 Creating plan directory
2024/07/01 13:35:45.361239 Preparing paths
2024/07/01 13:35:45.361550 Running build command
2024/07/01 13:35:45.365705
Paketo Buildpack for Amazon Corretto 8.5.1
https://github.com/paketo-buildpacks/amazon-corretto
Build Configuration:
$BP_JVM_JLINK_ARGS --no-man-pages --no-header-files --strip-debug --compress=1 configure custom link arguments (--output must be omitted)
$BP_JVM_JLINK_ENABLED false enables running jlink tool to generate custom JRE
$BP_JVM_TYPE JRE the JVM type - JDK or JRE
$BP_JVM_VERSION 21 the Java version
Launch Configuration:
$BPL_DEBUG_ENABLED false enables Java remote debugging support
$BPL_DEBUG_PORT 8000 configure the remote debugging port
$BPL_DEBUG_SUSPEND false configure whether to suspend execution until a debugger has attached
$BPL_HEAP_DUMP_PATH write heap dumps on error to this path
$BPL_JAVA_NMT_ENABLED true enables Java Native Memory Tracking (NMT)
$BPL_JAVA_NMT_LEVEL summary configure level of NMT, summary or detail
$BPL_JFR_ARGS configure custom Java Flight Recording (JFR) arguments
$BPL_JFR_ENABLED false enables Java Flight Recording (JFR)
$BPL_JMX_ENABLED false enables Java Management Extensions (JMX)
$BPL_JMX_PORT 5000 configure the JMX port
$BPL_JVM_HEAD_ROOM 0 the headroom in memory calculation
$BPL_JVM_LOADED_CLASS_COUNT 35% of classes the number of loaded classes in memory calculation
$BPL_JVM_THREAD_COUNT 250 the number of threads in memory calculation
$JAVA_TOOL_OPTIONS the JVM launch flags
Using Java version 21 from BP_JVM_VERSION
2024/07/01 13:35:45.365770 No valid JRE available, providing matching JDK instead. Using a JDK at runtime has security implications.
2024/07/01 13:35:45.365929 Corretto JDK 21.0.3: Contributing to layer
2024/07/01 13:35:45.365950 Downloading from https://corretto.aws/downloads/resources/21.0.3.9.1/amazon-corretto-21.0.3.9.1-linux-aarch64.tar.gz
2024/07/01 13:35:47.551877 Verifying checksum
2024/07/01 13:35:47.673413 Expanding to /layers/paketo-buildpacks_amazon-corretto/jdk
2024/07/01 13:35:49.844720 Adding 137 container CA certificates to JVM truststore
2024/07/01 13:35:50.108388 Writing env.build/JAVA_HOME.default
2024/07/01 13:35:50.108450 Writing env.build/JRE_HOME.default
Writing env.launch/BPI_APPLICATION_PATH.default
2024/07/01 13:35:50.108466 Writing env.launch/BPI_JVM_CACERTS.default
Writing env.launch/BPI_JVM_CLASS_COUNT.default
Writing env.launch/BPI_JVM_SECURITY_PROVIDERS.default
Writing env.launch/JAVA_HOME.default
2024/07/01 13:35:50.108479 Writing env.launch/JAVA_TOOL_OPTIONS.append
Writing env.launch/JAVA_TOOL_OPTIONS.delim
Writing env.launch/MALLOC_ARENA_MAX.default
2024/07/01 13:35:50.108812 Launch Helper: Contributing to layer
2024/07/01 13:35:50.110031 Creating /layers/paketo-buildpacks_amazon-corretto/helper/exec.d/java-opts
Creating /layers/paketo-buildpacks_amazon-corretto/helper/exec.d/jvm-heap
Creating /layers/paketo-buildpacks_amazon-corretto/helper/exec.d/link-local-dns
Creating /layers/paketo-buildpacks_amazon-corretto/helper/exec.d/memory-calculator
Creating /layers/paketo-buildpacks_amazon-corretto/helper/exec.d/security-providers-configurer
Creating /layers/paketo-buildpacks_amazon-corretto/helper/exec.d/jmx
Creating /layers/paketo-buildpacks_amazon-corretto/helper/exec.d/jfr
Creating /layers/paketo-buildpacks_amazon-corretto/helper/exec.d/openssl-certificate-loader
Creating /layers/paketo-buildpacks_amazon-corretto/helper/exec.d/security-providers-classpath-9
Creating /layers/paketo-buildpacks_amazon-corretto/helper/exec.d/debug-9
Creating /layers/paketo-buildpacks_amazon-corretto/helper/exec.d/nmt
2024/07/01 13:35:50.111528 Java Security Properties: Contributing to layer
Writing env.launch/JAVA_SECURITY_PROPERTIES.default
Writing env.launch/JAVA_TOOL_OPTIONS.append
2024/07/01 13:35:50.111985 Writing env.launch/JAVA_TOOL_OPTIONS.delim
2024/07/01 13:35:50.112003 Processing layers
2024/07/01 13:35:50.112608 Updating environment
2024/07/01 13:35:50.112922 Reading output files
2024/07/01 13:35:50.114692 Updating buildpack processes
2024/07/01 13:35:50.114720 Updating process list
2024/07/01 13:35:50.114888 Finished running build for buildpack paketo-buildpacks/amazon-corretto@8.5.1
Running build for buildpack paketo-buildpacks/ca-certificates@3.8.2
Looking up buildpack
2024/07/01 13:35:50.114937 Finding plan
Creating plan directory
2024/07/01 13:35:50.115040 Preparing paths
2024/07/01 13:35:50.115296 Running build command
2024/07/01 13:35:50.150292
Paketo Buildpack for CA Certificates 3.8.2
2024/07/01 13:35:50.150350 https://github.com/paketo-buildpacks/ca-certificates
2024/07/01 13:35:50.150827 Build Configuration:
2024/07/01 13:35:50.150965 $BP_EMBED_CERTS false Embed certificates into the image
$BP_ENABLE_RUNTIME_CERT_BINDING true Deprecated: Enable/disable certificate helper layer to add certs at runtime
$BP_RUNTIME_CERT_BINDING_DISABLED false Disable certificate helper layer to add certs at runtime
2024/07/01 13:35:50.154240 Launch Helper: Contributing to layer
2024/07/01 13:35:50.156644 Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper
2024/07/01 13:35:50.161171 Processing layers
2024/07/01 13:35:50.161414 Updating environment
Reading output files
2024/07/01 13:35:50.161445 Updating buildpack processes
Updating process list
Finished running build for buildpack paketo-buildpacks/ca-certificates@3.8.2
Running build for buildpack paketo-buildpacks/bellsoft-liberica@10.8.1
Looking up buildpack
2024/07/01 13:35:50.162556 Finding plan
Creating plan directory
2024/07/01 13:35:50.162580 Preparing paths
2024/07/01 13:35:50.162664 Running build command
2024/07/01 13:35:50.201163 Processing layers
2024/07/01 13:35:50.201264 Updating environment
2024/07/01 13:35:50.201284 Reading output files
2024/07/01 13:35:50.201359 Updating buildpack processes
Updating process list
Finished running build for buildpack paketo-buildpacks/bellsoft-liberica@10.8.1
2024/07/01 13:35:50.201388 Running build for buildpack paketo-buildpacks/syft@1.47.1
Looking up buildpack
2024/07/01 13:35:50.201694 Finding plan
Creating plan directory
Preparing paths
2024/07/01 13:35:50.201825 Running build command
2024/07/01 13:35:50.237719
Paketo Buildpack for Syft 1.47.1
https://github.com/paketo-buildpacks/syft
2024/07/01 13:35:50.244544 Downloading from https://github.com/anchore/syft/releases/download/v0.105.1/syft_0.105.1_linux_amd64.tar.gz
2024/07/01 13:35:50.891596 Verifying checksum
2024/07/01 13:35:51.249119 Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default
2024/07/01 13:35:51.250905 Processing layers
2024/07/01 13:35:51.251140 Updating environment
2024/07/01 13:35:51.251233 Reading output files
2024/07/01 13:35:51.251618 Updating buildpack processes
Updating process list
Finished running build for buildpack paketo-buildpacks/syft@1.47.1
Running build for buildpack paketo-buildpacks/maven@6.17.3
Looking up buildpack
2024/07/01 13:35:51.253865 Finding plan
Creating plan directory
2024/07/01 13:35:51.254133 Preparing paths
2024/07/01 13:35:51.254237 Running build command
2024/07/01 13:35:51.292106
Paketo Buildpack for Maven 6.17.3
2024/07/01 13:35:51.292225 https://github.com/paketo-buildpacks/maven
2024/07/01 13:35:51.293045 Build Configuration:
2024/07/01 13:35:51.293169 $BP_EXCLUDE_FILES colon separated list of glob patterns, matched source files are removed
$BP_INCLUDE_FILES colon separated list of glob patterns, matched source files are included
$BP_JAVA_INSTALL_NODE false whether to install Yarn/Node binaries based on the presence of a package.json or yarn.lock file
$BP_MAVEN_ACTIVE_PROFILES the active profiles (comma separated: such as: p1,!p2,?p3) to pass to Maven
$BP_MAVEN_ADDITIONAL_BUILD_ARGUMENTS the additionnal arguments (appended to BP_MAVEN_BUILD_ARGUMENTS) to pass to Maven
$BP_MAVEN_BUILD_ARGUMENTS -Dmaven.test.skip=true --no-transfer-progress package --batch-mode the arguments to pass to Maven
$BP_MAVEN_BUILT_ARTIFACT target/ the built application artifact explicitly. Supersedes $BP_MAVEN_BUILT_MODULE
$BP_MAVEN_BUILT_MODULE the module to find application artifact in
$BP_MAVEN_DAEMON_ENABLED false use maven daemon
$BP_MAVEN_POM_FILE pom.xml the location of the main pom.xml file, relative to the application root
$BP_MAVEN_SETTINGS_PATH the path to a Maven settings file
$BP_MAVEN_VERSION 3 the Maven version
$BP_NODE_PROJECT_PATH configure a project subdirectory to look for `package.json` and `yarn.lock` files
2024/07/01 13:35:51.316994
Paketo Buildpack for Maven 6.17.3
unable to create application layer
failed to generate expected metadata
unable to determine java version
error executing 'javac -version':
Combined Output: :
unable to start PTY
fork/exec /layers/paketo-buildpacks_amazon-corretto/jdk/bin/javac: no such file or directory
2024/07/01 13:35:51.317631 Timer: Builder ran for 5.958545336s and ended at 2024-07-01T18:35:51Z
2024/07/01 13:35:51.318236 ERROR: failed to build: exit status 1
2024/07/01 13:35:52.044104 ERROR: failed to build: executing lifecycle: failed with status code: 51
Possible Solution
I suspect that the aarch version of Corretto is installing the JDK in an unexpected location. Given how abstracted the corretto install is with buildpacks, I was not able to confirm this. I also do not know how to direct the pack CLI to "stop" before the maven layer installation to inspect the docker image at that point.
Steps to Reproduce
I created an example repo with a very simple Java project. The repo has a Github action for the AMD build. Github does not currently provide ARM runners for free repos. There is a script in the project for the ARM build: `
Motivations
We are exploring switching to using AWS Graviton services for our ECS services to reduce cost. We are currently using Paketo buildpacks for building our docker images and would like to continue to do so. We hit this bug while exploring how easy ARM builds would be.
There appears to be a bug when building a project using Corretto, Maven, and ARM64. Based on the error message it is likely a PATH issue in the Corretto installation. If I switch back to AMD64 the problem goes away. It also goes away if I switch off of Corretto.
Expected Behavior
The project successfully builds with
pack
Current Behavior
The Maven layer fails because it cannot find
javac
.Pack command
Error message:
Log output is below. This error does not happen when using AMD64.
Possible Solution
I suspect that the
aarch
version of Corretto is installing the JDK in an unexpected location. Given how abstracted the corretto install is with buildpacks, I was not able to confirm this. I also do not know how to direct the pack CLI to "stop" before the maven layer installation to inspect the docker image at that point.Steps to Reproduce
I created an example repo with a very simple Java project. The repo has a Github action for the AMD build. Github does not currently provide ARM runners for free repos. There is a script in the project for the ARM build: `
Motivations
We are exploring switching to using AWS Graviton services for our ECS services to reduce cost. We are currently using Paketo buildpacks for building our docker images and would like to continue to do so. We hit this bug while exploring how easy ARM builds would be.