0
votes

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 advanceenter image description here

enter image description here

2
I think you don't have the compatible version of dependency in OSGi container. So go to the /system/console/bundles and upload the org.jsoup jar of versions [1.7,2) . - Vivek Dhiman

2 Answers

0
votes

There is a version mismatch. Your bundle depends on the packages org.jsoup and friends having version 1.7 or higher. Strictly speaking it imports from version 1.7.0 (inclusive) up to version 2.0.0 (exclusive).

However, the bundle installed in your runtime exports as version 0.0.0. Therefore the import does not match the available exports and your bundle cannot resolve.

It seems you need to find an org.jsoup bundle that exports as version 1.7, and install that into your runtime instead of the bundle you have used here.

0
votes

There a couple of various ways to resolve your problem:

  1. Force import 0.0.0 version exported by your Jsoup bundle. (easiest)
    This can be performed by update of Import-Package section of your bundle which consumes Jsoup packages:
  <Import-Package>
  org.jsoup.*;resolution:=required;version="[0.0,0.1)"
  </Import-Package>
  1. Wrap your Jsoup dependency with Maven POM and set version which you would like to export via update of Export-Package section (optional):
 <Export-Package>
 org.jsoup.*;version="1.7.2"
 </Export-Package>

Details: http://www.cqblueprints.com/tipsandtricks/build-and-deploy-osgi/deploy-third-party-libs.html

  1. Install another Jsoup JAR as OSGi bundle.
    Original Jsoup 1.7.2 (http://mvnrepository.com/artifact/org.jsoup/jsoup/1.7.2) was good in my project.

  2. Update your Maven "dependency" item to import:

<dependency>
    <groupId>com.adobe.cq.jsoup</groupId>
    <artifactId>jsoupservice-bundle</artifactId>
    <version>1.0-SNAPSHOT</version>  
</dependency>