From d0ae82c39fdde684f653050b304fbfb555500df9 Mon Sep 17 00:00:00 2001 From: Ryan Schmitt Date: Fri, 22 May 2026 17:21:57 -0700 Subject: [PATCH] build(log4j2): Pin compilation to JDK 8 via Maven Toolchains Release 1.6.3 was built on a JDK that does not run annotation processors by default, which silently dropped the Log4j2 plugin descriptor (META-INF/.../Log4j2Plugins.dat) for LambdaAppender, LambdaTextFormat, and LambdaJsonFormat. The published artifact was broken at runtime: log4j could not resolve , , or elements in user log4j2.xml configurations. Configure maven-toolchains-plugin to require a JDK 8 toolchain so javac comes from a JDK that runs annotation processors by default, regardless of which JVM Maven is invoked under. The version range [1.8,9) matches both "1.8" and "8". The existing GitHub Actions workflow at .github/workflows/aws-lambda-java-log4j2.yml uses actions/setup-java@v5 with java-version: 8 and distribution: corretto. setup-java@v5 auto-generates a ~/.m2/toolchains.xml entry with 8, which the [1.8,9) range matches, so no workflow changes are required. When no matching JDK 8 toolchain is available, the build now fails fast at the validate phase with a clear "Cannot find matching toolchain definitions" error instead of silently producing an artifact missing its plugin descriptor. --- aws-lambda-java-log4j2/pom.xml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/aws-lambda-java-log4j2/pom.xml b/aws-lambda-java-log4j2/pom.xml index 6f142d57..7acc9f7a 100644 --- a/aws-lambda-java-log4j2/pom.xml +++ b/aws-lambda-java-log4j2/pom.xml @@ -62,6 +62,32 @@ + + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.2.0 + + + + + [1.8,9) + + + + + + + toolchain + + + + + + + dev