You are using an AEM Project that was built by the wcm.io Maven Archetype for AEM or inherits the build settings from wcm.io AEM Global Parent.
Your project is currently configured for Java 8 and you want to switch to Java 11 (which is supported and recommended since AEM 6.5).
aem-global-parent
(at least version 1.2.34, which includes global-parent
26).Remove:
<!-- compiler settings --> <build.compiler.source>1.8</build.compiler.source> <build.compiler.target>1.8</build.compiler.target> |
Add instead:
<!-- Java version --> <java.version>11</java.version> |
If you are using annotations like javax.annotation.PostConstruct
in your Sling Model classes you need to add this dependency to your OSGi bundle POMs (it's version is defined in the wcm.io AEM Dependencies POM since version 6.5.0):
<dependency> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-annotation_1.3_spec</artifactId> <scope>provided<scope> </dependency> |
<Java 11 Path>/bin
to your system path (before any other Java paths) to achieve this.If you want to compile with Java 11 but produce artifacts compatible with Java 8, do the same steps as described above, but add a different properties block:
<!-- Java version --> <java.version>1.8</java.version> <build.compiler.release>8</build.compiler.release> |
|