@Marcel Offermans answer is correct, you must install all the dependencies that your package should run, if there are too many of them, you do not manage them properly. How easy it is to deploy them, CQ5 has a good way to do this.
In CQ5, you usually install applications through packages that are nothing but a zip file that contains both the content to be copied to the JCR repository and any Java package that your application may need.
You may have noticed that, as a rule, in CQ5 applications you have 2 maven modules, (tip: use their maven archetypes to create your projects) for content and one for java code (there can be more than one or none). What happens when creating a content package is that any package that uses the same group identifier is automatically embedded in the package, but you use any package that is not already installed, you must configure it so that it is embedded .
This sample configuration is taken from the documentation. It should give you an idea of how to add any dependency you need to deploy to the OSGi container along with your application:
<plugin> <groupId>com.day.jcr.vault</groupId> <artifactId>content-package-maven-plugin</artifactId> <version>0.0.20</version> <extensions>true</extensions> <configuration> <filters> <filter> <root>/apps/myapp</root> </filter> </filters> <embeddeds> <embedded> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.jcr.jackrabbit.usermanager</artifactId> <target>/apps/myproject/install</target> </embedded> </embeddeds> </configuration> </plugin>
as a final tip, use the OSGi dependency search in http://localhost:4502/system/console/depfinder to find any dependency you might need. It may already be installed in your instance if you do not notice.
If you want to embed the jar inside the package so that it is not open, you can do it with the maven-bundle-plugin (I assume you use it since it is the standard for AEM development) using the Embed-Dependency command:
<Embed-Dependency>artifactId</Embed-Dependency>
See the documentation for more information on how to use this command.
source share