I have included third party jar file in my project, I got the following error
[xxxxx ] in start level 20 but no bundle is exporting these for that start level
I found following article to fix this
https://aemconcepts.com/aem-osgi/use-3rd-party-api-or-jar-or-dependency-in-aem/
adding
Reference osgi.ds.satisfying.condition | Satisfied Service Name: org.osgi.service.condition.Condition Target Filter: (osgi.condition.id=true) Cardinality: 1..1 Policy: dynamic Policy Option: reluctant |
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Mshaji ,
The secret sauce is,
Add
-conditionalpackage: org.apache.sling.servlethelpers.*,com.demo.package.*
inside the bnd-process plugin goal. So your bnd-process of parent pom.xml should look like this:
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>${bnd.version}</version>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd>
<![CDATA[
Bundle-Category: ${componentGroupName}
-exportcontents: ${removeall;${packages;VERSIONED};${packages;CONDITIONAL}}
-noextraheaders: true
-snapshot: SNAPSHOT
-conditionalpackage: org.apache.sling.resource.filter.*
Bundle-DocURL:
-plugin org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin
-plugin org.apache.sling.bnd.models.ModelsScannerPlugin
]]>
</bnd>
</configuration>
</execution>
</executions>
</plugin>
An excellant article explaining difference between conditionalpackage and includeresource is here - https://myaemlearnings.blogspot.com/2021/12/embed-third-party-dependency-using-bnd.html
Just adding the -conditionalpackage to your plugin should solve your issue.
Hi @Mshaji ,
The secret sauce is,
Add
-conditionalpackage: org.apache.sling.servlethelpers.*,com.demo.package.*
inside the bnd-process plugin goal. So your bnd-process of parent pom.xml should look like this:
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>${bnd.version}</version>
<executions>
<execution>
<id>bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd>
<![CDATA[
Bundle-Category: ${componentGroupName}
-exportcontents: ${removeall;${packages;VERSIONED};${packages;CONDITIONAL}}
-noextraheaders: true
-snapshot: SNAPSHOT
-conditionalpackage: org.apache.sling.resource.filter.*
Bundle-DocURL:
-plugin org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin
-plugin org.apache.sling.bnd.models.ModelsScannerPlugin
]]>
</bnd>
</configuration>
</execution>
</executions>
</plugin>
An excellant article explaining difference between conditionalpackage and includeresource is here - https://myaemlearnings.blogspot.com/2021/12/embed-third-party-dependency-using-bnd.html
Just adding the -conditionalpackage to your plugin should solve your issue.