Expand my Community achievements bar.

Regarding External Dependencies

Avatar

Employee

Hi, I want to import following things on my servlet. Can anyone let me know what is the process to add external dependencies and also what external dependencies are needed?

import org.xhtmlrenderer.pdf.ITextRenderer;
import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.BaseFont;
7 Replies

Avatar

Community Advisor

Hello @sakethchandra02 

 

Dependencies would be 

<!-- https://mvnrepository.com/artifact/org.xhtmlrenderer/flying-saucer-pdf-itext5 -->
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-itext5</artifactId>
<version>9.0.1</version>
</dependency>

 

<!-- https://mvnrepository.com/artifact/com.lowagie/itext -->
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>

 

To use these dependencies, you can add the bundles in parent's pom.xml and all modules's pom.xml, like described on https://techrevel.blog/2023/09/27/managing-third-party-dependencies-in-aem/. Just refer to following:

aanchalsikka_0-1699004061082.png

 


Aanchal Sikka

Avatar

Employee

Thanks a lot for the response. My core bundle is now stuck in installed state with the following error

sakethchandra02_0-1699004633368.png

I have added them as dependencies in core pom as well (As I was getting an error while build). Now the build is successful but core isn't getting active. Can you please let me know if there is anything missing here?

Avatar

Community Advisor

<!-- https://mvnrepository.com/artifact/org.xhtmlrenderer/flying-saucer-core -->
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-core</artifactId>
<version>9.3.1</version>
</dependency>

 

<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-itext5</artifactId>
<version>9.3.1</version>
</dependency>

 

 

Updated version of earlier dependency


Aanchal Sikka

Avatar

Community Advisor

@sakethchandra02 

 

Each of the dependencies have their pom.xml in maven. Like:

Maven Repository: org.xhtmlrenderer » flying-saucer-pdf-itext5 » 9.3.1 (mvnrepository.com)

repo1.maven.org/maven2/com/lowagie/itext/4.2.2/itext-4.2.2.pom

 

requesting you to please check their dependencies in pom.xml and import the ones needed. It should help resolve the issue


Aanchal Sikka

Avatar

Community Advisor

Hi @sakethchandra02 
Please check if the external dependencies are are resolved or not in AEM.

It might be possible that the dependencies are the jar but not the osgi bundles.



Arun Patidar

Avatar

Administrator

@sakethchandra02 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni