Search code examples
javaosgiaemapache-felixfelix-dependency-manager

OSGI un used Import packages make as optional


Am trying to create an aem workflow java process step, adding the below dependency in the pom.xml file dependencies list once i add the bundle build is fine but it is in Installed state only because of the below two errors.

        <dependency>
        <groupId>com.day.cq.workflow</groupId>
        <artifactId>cq-workflow-api</artifactId>
        <version>5.6.2</version>
        <scope>provided</scope>
    </dependency>

i have tried adding the dependency but still no use, the error remains same

<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.8.3</version>
<scope>provided</scope>

And also i have tried to keep the imports as optional still no use

<Import-Package>net.sf.ehcache,net.spy.memcached,*;resolution:=optional</Import-Package>

Error Message: Error message in AEM Felix console


Solution

  • Simply add the build time dependencies to ehcache and memcached as <optional>true</optional> in the maven pom. bnd will then create the imports as optional and it should work. No need to have a Import-Package Element.