Update Java JDK to v11 for AEM Cloud

Published
By default, AEM projects are built by Cloud Manager build process using Oracle 8 JDK, but AEM Cloud Service customers are strongly advised to set the JDK version used to execute Maven to 11 for improved performance, security, and support over earlier versions.
It is recommended to set the JDK version for the entire Maven execution to 11 by configuring the .cloudmanager/java-version file within the Git repository branch used by the pipeline. When 11 is specified, Oracle 11 is used and the JAVA_HOME environment variable is set to /usr/lib/jvm/jdk-11.0.22.
.cloudmanager / java-version
11
After configuring the JDK version in Cloud Manager, ensure you update the Java version to 11 in the root POM file. Set Java 11 for both the maven-enforcer-plugin and maven-compiler-plugin plugins to leverage new JDK 11 features.
pom.xml
<!-- Maven Enforcer Plugin --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <executions> <execution> <id>enforce-maven</id> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <requireMavenVersion> <version>[3.3.9,)</version> </requireMavenVersion> <requireJavaVersion> <message>Project must be compiled with Java 11 or higher</message> <version>11</version> </requireJavaVersion> </rules> </configuration> </execution> </executions> </plugin> <!-- Maven Compiler Plugin --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>11</source> <target>11</target> </configuration> </plugin>

Frequently Asked Questions (FAQ)

Cannot access org.apache.jackrabbit.api.security.user.Group bad class file: /root/.m2/repository/com/adobe/aem/aem-sdk-api/2024.7.17258.20240726T172406Z-240700/aem-sdk-api-2024.7.17258.20240726T172406Z-240700.jar(org/apache/jackrabbit/api/security/user/Group.class) class file has wrong version 55.0, should be 52.0

Ensure Cloud Manager uses Java JDK v11.