Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Embedding Third party dependency/OSGi bundle in AEM application hosted in AEMasCS | AEM Community Blog Seeding

kautuk_sahni
Community Manager
Community Manager

BlogImage.jpg

Embedding Third party dependency/OSGi bundle in AEM application hosted in AEMasCS by Myaemlearnings

Abstract

This post illustrate the ways of embedding third party dependency in AEM maven project.
Steps are mentioned considering the project structure to be followed for AEMasCS while the same can be followed for classic versions too.

Before we begin, I would like to explain the scenario of including a dependency in our AEM maven project.
When we would like to make use of an API that is not already available in our project, we look for that in maven-central repository and specify the dependency in main pom.xml and desired module's pom.xml file. (Lets say, AWS S3 Java SDK V2 dependency)
Upon updating the project in the IDE, we would see our class files (making use of those APIs) are compiled/build successfully without any errors.
Now, in the context of AEM/OSGi environment, when the same package and hence the bundle is deployed to AEM instance, dependencies that we added new might not be resolved/available in the OSGi as a bundle. Something like the below

This indicates that the added dependency is resolved in the context of Maven project and is not in the context of OSGi which paves way for the need of OSGi bundle of the desired dependency.
While this is possible with our existing core module itself which makes use of bnd-maven-plugin (plugin in recent archetype versions for building core module), some dependencies which are in turn dependent on other dependencies(referred to as transitive dependencies) could not be resolvable as bundle in OSGi. Hence the need for maven-bundle-plugin.
Creating an OSGi bundle out of third party non-osgi dependency using maven-bundle-plugin is explained in this blog post which is about building and deploying the OSGi bundle outside project code base as a standalone third party bundle.

Read Full Blog

Embedding Third party dependency/OSGi bundle in AEM application hosted in AEMasCS

Q&A

Please use this thread to ask the related questions.

0 Replies