devel:dependency:batik
Preparing minimal Apache Batik
The aim is to prepare a cut-down version of Apache Batik with the minimal set of JARs necessary for building and running Workcraft (this effort results in ~10MB size reduction):
- Download JARs of Batik binary distribution from https://xmlgraphics.apache.org/batik/download.html
- Download JAR for FOP Transcoder from https://mvnrepository.com/artifact/org.apache.xmlgraphics/fop-transcoder
- Remove not needed JARs based on the following Workcraft dependency analysis:
- Compile-time dependency
batik-anim– needed for SVG (SAXSVGDocumentFactory)batik-awt-util– needed for SVG (AbstractGraphics2D, SVGGraphics2D)batik-bridge– needed for GUI (UserAgentAdapter, BridgeContext, GVTBuilder)batik-constants– needed for XML constants (XMLConstants)batik-css– needed for creating icon from SVG (CSSContext)batik-dom– needed for creating icon from SVG (DocumentFactory)batik-gvt– needed for creating icon from SVG (GraphicsNode)batik-svg-dom– needed for creating icon from SVG (SVGDocumentFactory)batik-svggen– needed for exporting in SVG format (SVGGraphics2D)batik-transcoder– needed for exporting in PDF, PS, EPS formats (Transcoder, TranscoderInput, TranscoderOutput, TranscoderException)batik-util– needed for loading SVG files (XMLResourceDescriptort)fop-transcoder– needed for exporting in PDF, PS, EPS formats (PDFTranscoder, PSTranscoder, EPSTranscoder, PNGTranscoder)
- Run-time dependency
batik-codec– needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/xmlgraphics/java2d/color/NamedColorSpace)batik-ext– needed for loading SVG files (java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal)batik-i18n– needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/batik/anim/dom/SVGDOMImplementation)batik-parser– needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/batik/parser/UnitProcessor$Context)batik-script– needed for loading SVG files (java.lang.NoClassDefFoundError: Could not initialize class org.apache.batik.bridge.BridgeContext)batik-xml– needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/batik/dom/util/DOMUtilities)xml-apis-ext– needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/batik/anim/dom/SVGOMDocument)xmlgraphics-commons– needed for loading SVG files (java.lang.NoClassDefFoundError: org/apache/xmlgraphics/java2d/color/NamedColorSpace)
- Not needed
batik-extensionbatik-gui-utilbatik-jsbatik-rasterizerbatik-rasterizer-extbatik-shared-resources(since v1.18)batik-slideshowbatik-squigglebatik-squiggle-extbatik-svgbrowser(since v1.18)batik-svgppbatik-svgrasterizerbatik-swingbatik-testbatik-test-oldbatik-test-svgbatik-test-swingbatic-ttf2svgbatik-util-*-tests(since v1.18)fop-pdf-imagesrhino(since v1.18)serialiser(since v1.18)xml-apis– there is still run-time dependency on xml-apis-ext
If extra ~10MB and several unnecessary dependencies are not a problem, then Batik and FOP transcoders can be included via Gradle in dependencies section of WorkcraftCore\build.gradle as follows:
lib 'org.apache.xmlgraphics:batik-transcoder:1.18' lib 'org.apache.xmlgraphics:fop-transcoder:2.10'
Copyright © 2014-2024 workcraft.org