AEM 6.5 and JDK 11
As of AEM 6.5, JDK 11 is supported along side JDK 8. As such, Devs will begin developing and testing AEM on JDK 11 you can check the technical requirements and see Adobe’s notes on JDK 11. You should also read the Oracle/Adobe License Agreement. also read Dan’s post on the matter here.
The Java Common Annotations Module
As an AEM dev, you probably did not realize it, but you were using this module all along. The @PostConstruct annotation used by sling models is part of that module. The removal of that module from JDK 11 means that you’ll get a compile error on any classes that use that annotation.
Including the Java Common Annotations Dependency in Your Project
<!-- https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api --> <dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId> <version>1.3.2</version> <scope>provided</scope> </dependency>
You might be wondering, what about the OSGI container? Doesn’t it run on the same JDK? well, yes! but it uses a different dependency! go to http://localhost:4502/system/console/depfinder and look for
and you’ll see it uses this dependency:
<dependency> <artifactId>geronimo-annotation_1.3_spec</artifactId> <version>1.0</version> <groupId>org.apache.geronimo.specs</groupId> <scope>provided</scope> </dependency>
You can use whichever dependency works for you, so long as you have it in your project!
Ahmed is an Adobe Technical Lead and expert in the Adobe Experience Cloud.