AEM Cloud Manager: Dev Pipeline Build Fails with ‘Project must be compiled with Java 21 or higher’
This article explains how to resolve build failures in Adobe Experience Manager Cloud Manager pipelines caused by Java version requirements.
Description description
Environment
Adobe Experience Manager (AEM) Cloud Manager (all versions)
Issue/Symptoms
When running a non-production development pipeline in Cloud Manager, the build fails with a Maven enforcer plugin error requiring Java 21 or higher. The following error appears in the build logs:
11:28:07,666 [ main] [ WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
Project must be compiled with Java 21 or higher
- The pipeline build stops, and subsequent modules are skipped.
Root cause
The build failed because the project requires Java 21 or higher, but the pipeline was not configured to use the correct Java version via the .cloudmanager/java-version file.
Resolution resolution
Follow these steps to resolve the issue
- Verify that your repository contains the file
.cloudmanager/java-versionat the root level. - Open the
.cloudmanager/java-versionfile and ensure it contains only the value21(no extra spaces or characters). - If the file does not exist, create it at the root of your repository and add the value
21. - Commit and push the change to your repository.
- Re-run the Cloud Manager pipeline to confirm the build completes successfully.
Related reading
[Set the Maven JDK Version](https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/using-cloud-manager/create-application-project/build-environment-details#: :text=Set%20the%20Maven%20JDK,Java%2017%20is%20used)