Vishnu Jangid
Vishnu Jangid

Reputation: 1

How to add dependency independent of another bundle in AEM

I want to add a dependency specifically webp-imageio-sejda in my current project (project A), for this jar to be available to my bundle I have to embed it. In my AEM instance there already exist a bundle (project B) which already contains the same dependency and it is also embedded into that bundle.

Project A pom.xml :

   ......
    <Embed-dependency> webp-iamgeio </Embed-dependency>
   ......

<dependencies>
    <!-- https://mvnrepository.com/artifact/org.sejda.imageio/webp-imageio -->
    <dependency>
        <groupId>org.sejda.imageio</groupId>
        <artifactId>webp-imageio</artifactId>
        <version>0.1.6</version>
        <scope> provided </scope>
    </dependency>
</dependencies>

Project B POM.xml

.....
    <Embed-dependency> webp-iamgeio </Embed-dependency>
......

<dependencies>
    <!-- https://mvnrepository.com/artifact/org.sejda.imageio/webp-imageio -->
    <dependency>
        <groupId>org.sejda.imageio</groupId>
        <artifactId>webp-imageio</artifactId>
        <version>0.1.6</version>
        <scope> provided </scope>
    </dependency>
</dependencies>

The problem is when I deploy my bundle (Project A) and run any service which is using a class (WebPWriteParam) from webp-imageio-sejda I am facing an error

java.lang.ClassCastException: class com.luciad.imageio.webp.WebPWriteParam cannot be cast to class com.luciad.imageio.webp.WebPWriteParam

This is because I have same JAR embedded in two different bundles. (Project A and Project B). I cannot Edit the POM of Project B.

Any idea How can I resolve this issue.

One solution I found that I can upload jar as an bundle and use that in both the bundles without embedding but I cannot edit the POM in the second bundle to remove embedding.

Thanks

AEM Community Post : https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-add-dependency-independent-of-another-bundle/td-p/548894

Upvotes: 0

Views: 536

Answers (0)

Related Questions