Cloud Manager build fails on Java 11 | AEM

Problem

AEM Cloud Manager build fails when attempting to switch the build from Java 8 to  Java 11.

Solution

The problem can have many causes.  However the most common ones are documentation below:

  1. Add the maven-toolchains-plugin with the correct settings for Java 11 as documented here.  For example, see the wknd sample project code.
  2. If you see the error below then you need to remove use of maven-scr-plugin and convert all OSGi annotations to OSGi R6 annotations.  For instructions, see here.
    [main] [ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.26.4:scr (generate-scr-scrdescriptor) on project helloworld.core: /build_root/build/testsite/src/main/java/com/adobe/HelloWorldServiceImpl.java : Unable to load compiled class: com.adobe.HelloWorldServiceImpl: com/adobe/HelloWorldServiceImpl has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 -> [Help 1]
  3. For cloud manager builds the maven enforcer plugin fails with error "[main] [WARNING] Rule 1: org.apache.maven.plugins.enforcer.RequireJavaVersion".  This is a known issue due to cloud manager using a different version of java to run the maven command versus compiling code.  For now, omit requireJavaVersion from your maven-enforcer-plugin configurations.
Adobe 標誌

登入您的帳戶