Update Apache Batik

BIRT uses Apache Batik, particularly for the SVG Image format. So let’s upgrade to the newest Apache Batik version (being 1.13 at the time of writing).

While newer Apache Batik Bundles are available on Orbit, not consistently so. At the time of writing, not all 1.13 Batik jar’s are available on Eclipse Orbit.

So the Author got them from here:
https://www.rpmfind.net/linux/RPM/opensuse/tumbleweed/noarch/xmlgraphics-batik-1.13-1.3.noarch.html
and here:
https://rpmfind.net/linux/RPM/opensuse/tumbleweed/noarch/xmlgraphics-batik-css-1.13-1.3.noarch.html
(Pls don’t ask why css is separately distributed)

As these bundles have transitive dependencies on org.w3c classes, these have to be made visible to Eclipse and the build environment. In earlier days, org.w3c classes were not part of the JDK and hence were provided with OSGi-Bundles.

So here we go again:
“/usr/lib/jvm/jdk1.8.0_271/bin/jar -cfm ch.adiinfo.batik.system.extensions-0.0.1.jar manifest-batik.mf”

The manifest-File being:

Bundle-ManifestVersion: 2
Bundle-SymbolicName: ch.adiinfo.batik.system.extensions
Bundle-Version: 0.0.1
Fragment-Host: system.bundle; extension:=framework
Bundle-Name: Batik Framework Extension
Bundle-Description: Bundle exporting JRE libraries fro Batik
Export-Package: org.w3c.dom;version="3.0.0",org.w3c.dom.css;version="3.0.0",org.w3c.dom.traversal;version="3.0.0",org.w3c.dom.events;version="3.0.0",org.w3c.dom.stylesheets;version="3.0.0",org.w3c.dom.views;version="3.0.0",org.xml.sax,org.w3c.dom.xpath,org.xml.sax.ext,org.xml.sax.helpers,javax.xml.parsers,javax.xml.transform,javax.xml.transform.dom,javax.xml.transform.stream

These Bundles must be made available in a Repository. One can’t use a local directory as this will work in Eclipse IDE, but not for the Build with the Maven-Tycho plugin. The plugin does not accept directories as bundle source.

I will show in a separate Blog how to build a Repository.

Furthermore, you have to change dependencies in the Eclipse project and replace the references to Batik 1.7/1.9 to 1.13 (in MANIFEST.MF).

Regarding the build environment, there is also work to do:

Step one:
Search for plugin-id’s referencing “org.apache.batik”. Most of the plugin-id’s remain the same except the following one’s: org.apache.batik.svg-dom, org.apache.batik.awt-util, org.apache.batik.gui-util. These Id’s have to be changed. When a version is explicitly declared with a plugin-definition, change it to 1.13. If the version id is “0.0.0” (don’t care), you may leave it that way.

Step two:
The Maven-Tycho-Plugin has the source-code option activated. So unless you want to include the Batik-Source, we have to exclude all Batik-Bundles from the source-code option.
Look out for POM-Files an add this to the maven-tycho-plugin:

<configuration>
  <excludes>
    <!-- provide plug-ins not containing any source code -->
    <plugin id="javax.xml.rpc" />
    <plugin id="javax.xml.soap" />
    <plugin id="org.apache.axis" />
    <plugin id="javax.wsdl" />
    <plugin id="org.apache.xerces" />
    <plugin id="org.apache.xml.resolver" />
    <plugin id="org.apache.xml.serializer" />
    <plugin id="org.apache.batik.bridge"/>
    <plugin id="org.apache.batik.css"/>
    <plugin id="org.apache.batik.dom"/>
    <plugin id="org.apache.batik.svg-dom"/>
    <plugin id="org.apache.batik.awt-util"/>
    <plugin id="org.apache.batik.svggen"/>
    <plugin id="org.apache.batik.transcoder" />
    <plugin id="org.apache.batik.util"/>
    <plugin id="org.apache.batik.gui-util"/>
    <plugin id="org.apache.batik.xml"/>
    <plugin id="org.apache.batik.parser"/>
  </excludes>
</configuration>

So the result wil look like this:

<plugin>
  <groupId>org.eclipse.tycho.extras</groupId>
  <artifactId>tycho-source-feature-plugin</artifactId>
  <configuration>
    <excludes>
      <!-- provide plug-ins not containing any source code -->
      <plugin id="javax.xml.rpc" />
      <plugin id="javax.xml.soap" />
      <plugin id="org.apache.axis" />
      <plugin id="javax.wsdl" />
      <plugin id="org.apache.xerces" />
      <plugin id="org.apache.xml.resolver" />
      <plugin id="org.apache.xml.serializer" />
      <plugin id="org.apache.batik.bridge"/>
      <plugin id="org.apache.batik.css"/>
      <plugin id="org.apache.batik.dom"/>
      <plugin id="org.apache.batik.svg-dom"/>
      <plugin id="org.apache.batik.awt-util"/>
      <plugin id="org.apache.batik.svggen"/>
      <plugin id="org.apache.batik.transcoder" />
      <plugin id="org.apache.batik.util"/>
      <plugin id="org.apache.batik.gui-util"/>
      <plugin id="org.apache.batik.xml"/>
      <plugin id="org.apache.batik.parser"/>
    </excludes>
  </configuration>
</plugin>

0 Kommentare

Schreiben Sie einen Kommentar

Avatar placeholder

Ihre E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert