Recently while working on AEM 6.1, I had to move from Java 6 to Java 8. Simply changing the Java version in POM led to some issues with OSGi services. Specifically, those services that were using @Reference annotation were not getting active and remained in “satistied” state.
Here are all the steps I followed firstly to change Java version and then fixing above mentioned issue:
1. To build an AEM project with Java8 as runtime environment, following configuration is required in pom.xml. The Compiler Plugin is added to the parent POM, it is used to compile the sources of your project.
Default source and target setting is 1.5. If you want to change it to work with Java 8, you should set the source and target to 1.8.
2. If you want to use scr annotations in your project, you have to use maven-scr-plugin. And its version >= 1.17.0 for Java8
3. For SCR annotations, following dependency should be added in the project with the version >= 1.9.8 for Java8
Let me know if you face any issue with this by commenting on this post.
Hope this helps!!!