Piotr Karwasz created TIKA-4934:
-----------------------------------

             Summary: tika-bundle-standard: do not embed dependencies that are 
OSGi bundles
                 Key: TIKA-4934
                 URL: https://issues.apache.org/jira/browse/TIKA-4934
             Project: Tika
          Issue Type: Improvement
            Reporter: Piotr Karwasz


The {{tika-bundle-standard}} OSGi bundle is described as containing "the 
tika-parsers-standard component and all its upstream dependencies that aren't 
OSGi bundles by themselves," but its {{Embed-Dependency}} list also embeds many 
dependencies that ship proper OSGi manifests. As a result:

* these libraries are duplicated inside the bundle instead of being shared with 
other bundles in the container, and they can't be updated independently;
* {{commons-io}} is both embedded and installed as a separate bundle;
* {{pdfbox-io}} is not embedded at all, although {{pdfbox}} and {{fontbox}} 
require {{org.apache.pdfbox.io}}. Since every import of 
{{tika-bundle-standard}} is optional, the bundle resolves anyway and PDF 
parsing fails at runtime with {{NoClassDefFoundError}}.

h3. Proposed change

Stop embedding the following dependencies; they must be deployed as separate 
bundles alongside {{tika-core}} and {{tika-bundle-standard}}:

* {{commons-io:commons-io}}
* {{commons-codec:commons-codec}}
* {{commons-logging:commons-logging}} (1.4+, required by pdfbox; 
{{jcl-over-slf4j}} only exports version 1.2)
* {{org.apache.commons:commons-collections4}}
* {{org.apache.commons:commons-compress}}
* {{org.apache.commons:commons-csv}}
* {{org.apache.commons:commons-exec}}
* {{org.apache.commons:commons-lang3}}
* {{org.apache.commons:commons-math3}}
* {{org.apache.pdfbox:pdfbox}}
* {{org.apache.pdfbox:pdfbox-io}}
* {{org.apache.pdfbox:fontbox}}
* {{org.bouncycastle:bcprov-jdk18on}}, {{bcpkix-jdk18on}}, {{bcutil-jdk18on}}, 
{{bcjmail-jdk18on}}
* {{org.jsoup:jsoup}}
* {{org.ow2.asm:asm}}
* {{org.tukaani:xz}}
* {{com.adobe.xmp:xmpcore}}
* {{com.googlecode.plist:dd-plist}}

The following are OSGi bundles but stay embedded because they cannot be 
resolved as standalone bundles:

* {{apache-mime4j-core}} / {{apache-mime4j-dom}}: import 
{{org.apache.commons.io;version="[1.4,2)"}}, which commons-io 2.x does not 
satisfy;
* {{rome}}: requires {{org.jdom2}}, which is not an OSGi bundle;
* {{jackcess}} / {{jackcess-encrypt}} (fragment): {{jackcess}} uses 
{{org.apache.poi.poifs.filesystem}} for OLE attachments, and POI is only 
available inside {{tika-bundle-standard}}.

h3. Tests

{{BundleIT}} now installs every jar in {{target/test-bundles}} (populated by 
{{test-bundles.xml}}), asserts that all bundles are active, and checks that 
classes from each external dependency can be loaded through 
{{tika-bundle-standard}}, since optional imports would otherwise hide a missing 
bundle.

h3. Compatibility

OSGi users of {{tika-bundle-standard}} must deploy the bundles listed above. 
The list should be mentioned in {{CHANGES.txt}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to