Sometimes, AEM developers may struggle with how to work with third-party dependencies when developing custom OSGi services/servlets. We have seen threads in the forums that state that although they referenced the correct Maven POM dependencies, the bundle will not start in AEM. For example:
<dependency>
<groupId>net.bican</groupId>
<artifactId>jwordpress</artifactId>
<version>0.6.2</version>
<scope>provided</scope>
</dependency>
Simply by referencing this dependency (net.bican) in the POM file, this action does not place the package in the OSGi service container. As a result, this compiled bundle will not start in AEM without getting the package into AEM.
That is, if bundle A imports Java package X then in order for that bundle to be active in AEM, an AEM OSGi bundle must export package X. Otherwise, the bundle will not start. Just by referencing package X in your Maven POM file does not satisfy the requirement of getting package X into AEM.
To show this concept in action, see this AEM community article. It discusses this use case and how to work with third-party Java dependencies. As an example use case - an AEM component that integrates with WordPress was developed. See:
Developing AEM components that display WordPress information