Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

OSGi package dependencies not getting resolved

Avatar

Level 4

Hi,

I am trying to use Jsoup library by creating an OSGi bundle out of it. I have created the bundles before so I am pretty much familiar with the process. I have also added the dependencies in the pom.xml like this: 

<dependency> <groupId>org.jsoup</groupId> <artifactId>jsoup</artifactId> <version>1.7.3</version> </dependency> 

I am also following the steps given here: https://helpx.adobe.com/experience-manager/using/html-parser-service.html

I have tried everything but still the dependencies are not getting resolved. Attached are the screenshots.

What do I do ?

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Level 10

OPen the OSGi bundle in a tool like WInRAR:

[img]JSOUP.png[/img]

Extract and open the MF file. Remove the version information -- so it looks like:

[img]JSOUP2.png[/img]

Notice that there are no version information. Ensure a comma separetes the packages in the import section of the MF file. 

After you modify the MF file, place it back into the OSGi bundle in the same location. 

View solution in original post

4 Replies

Avatar

Level 3

the bundle that is installed is version 1.0.0, your code is using version 1.7.2. I suppose this is why dependencies are not resolved.

Avatar

Level 10

Two things you can do

1. In your dependency change the version from 1.7.3 to 1.0.0 and it should resolve the issue as mentioned by @awedesh. 

2. If you want to use the latest Jsoup, then dont install the JsoupBundle as mentioned in the article, instead include this latest version of jsoup jar in your bundle directly. 

Avatar

Level 4

The issue that I am facing is that the export package in json bundle are being exported as version 0.0.0. I have tried creating bundles out of jsoup library jar for every version from 1.7.2 to the latest 1.8.2 but I am still getting the same error. 

Avatar

Correct answer by
Level 10

OPen the OSGi bundle in a tool like WInRAR:

[img]JSOUP.png[/img]

Extract and open the MF file. Remove the version information -- so it looks like:

[img]JSOUP2.png[/img]

Notice that there are no version information. Ensure a comma separetes the packages in the import section of the MF file. 

After you modify the MF file, place it back into the OSGi bundle in the same location.