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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Embed Third party dependency using bnd-maven-plugin | AEM Community Blog Seeding




Embed Third party dependency using bnd-maven-plugin by AEM Learnings


Two main instructions of bnd-maven-plugin that serves the purpose are detailed below.

pick packages from respective library and copy them in the bundle. Any dependencies of those copied packages will also be copied if they match the selectors.
This means we need to explicitly list all the Java package names of desired dependency as part of this instruction (including its transitive dependencies)
More about conditionalpackage instruction from official docs -
For including resource inline
-includeresource: @artifactId-version.jar!/*
For embedding as a jar with an entry in bundle class path
-includeresource: artifactId-version.jar;lib:=true
For several other possible combinations for including the resource, please check -
With complete understanding on these two instructions from official docs + based on how we would like the dependency to be included, we can use any one of the instruction with its respective options accordingly.

Sample plugin entry for the dependency jackson-dataformat-csv (Supports reading and writing CSV)
where ${jackson-dataformat-csv.version} in the instruction resolves to a maven property holding the artifact version (2.9.5) as defined in parent pom.xml.




Bundle-Category: Demo
Import-Package: javax.annotation;version=0.0.0,*
-exportcontents: ${packages;VERSIONED}
Sling-Model-Packages: com.aem.demoproject.core.models
-snapshot: ${tstamp;yyyyMMddHHmmssSSS}
-dsannotations-options: inherit
-conditionalpackage: com.fasterxml.jackson.dataformat.csv.*

Read Full Blog

Embed Third party dependency using bnd-maven-plugin


Please use this thread to ask the related questions.

1 Reply


Level 1

Hi, The below snippet worked for me, Thanks


Import-Package: javax.annotation;version=0.0.0,*
-conditionalpackage: com.xx.*
-includeresource: @artifactid-versionnumber.jar!/