Support Java 21
Does this support Java 21 in Azure Web Apps ?
Recent deployement of ours based on JDK21 are now rejected with:
06:15:49,863 [ERROR] Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.36.0:deploy (default-cli) on project xxxx-yyyy: deploy to Function App with resource creation or updating: The artifact’s compile level (21) is not compatible with runtime ‘11’. Please rebuild the artifact with a lower level or switch to a higher Java runtime.
Our maven conf is indeed:
<runtime>
<!-- https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-runtime -->
<serverId>${docker.registry.root}</serverId>
<registryUrl>https://${docker.registry.root}</registryUrl>
<!-- Beware this parameter is named 'imageName' by AzureWebapp mvn plugin -->
<image>${docker.image.name}:${docker.tag}</image>
<!-- Typically 'linux' for standard image, or 'docker' for custom image -->
<os>${azure.functions.os}</os>
<javaVersion>11</javaVersion>
</runtime>
In https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details, we can read:
For windows/linux function, please set runtime java version with <javaVersion>, supported values are 8, 11 and 17
<runtime>
<os>windows</os>
<javaVersion>8</javaVersion>
</runtime>
While we rely on a custom DockerFile based on official Azure Function JDK21 images:
ARG AZUREFUNCTIONS_VERSION=4.0
# It seems using JAVA_VERSION only is polluted by the JVM version running in the CI
ARG AZUREFUNCTIONS_JAVA_VERSION=21
# https://github.com/Azure/azure-functions-docker#java
# change also entrypoint.sh if need change this variable
# This image is ssh enabled
FROM mcr.microsoft.com/azure-functions/java:${AZUREFUNCTIONS_VERSION}-java${AZUREFUNCTIONS_JAVA_VERSION}-appservice
So, yes, Azure Functions (and maven plugin) is compatible with JDK21, but the documentation is not up-to-date. It seemingly requires a custom Docker image (and this used not to be compatible with Consumption plan ; it is ucnlear if this is still a limitation). And we encounter JDK21 related issues since today (hence dropping some details here, we may go with a custom ticket).