4

I am trying to use the Batik library source, I only want to use the transcoder to convert SVG files to PNG or JPEG only. The distribution version of the Batik Rasterizer is about 55k but when I export the jar file its 7 megs. Can I just use the transcoder and not all the jars in the library? I am loading the jar files in Coldfusion. would it make more sense to just use the distribution version?

4

2 に答える 2

3

これは、batik-transcoder以下を使用した 1.6-1の依存関係ツリーmvn dependency:tree -Dverboseです。

[INFO] +- batik:batik-transcoder:jar:1.6-1:compile
[INFO] |  +- batik:batik-bridge:jar:1.6-1:compile
[INFO] |  |  +- batik:batik-gvt:jar:1.6-1:compile
[INFO] |  |  |  \- batik:batik-awt-util:jar:1.6-1:compile
[INFO] |  |  |     \- batik:batik-util:jar:1.6-1:compile
[INFO] |  |  |        \- (batik:batik-gui-util:jar:1.6-1:compile - omitted for duplicate)
[INFO] |  |  +- (batik:batik-bridge:jar:1.6-1:compile - omitted for cycle)
[INFO] |  |  +- batik:batik-script:jar:1.6-1:compile
[INFO] |  |  \- batik:batik-svg-dom:jar:1.6-1:compile
[INFO] |  |     +- batik:batik-dom:jar:1.6-1:compile
[INFO] |  |     |  +- batik:batik-css:jar:1.6-1:compile
[INFO] |  |     |  |  \- (batik:batik-util:jar:1.6-1:compile - omitted for duplicate)
[INFO] |  |     |  +- batik:batik-xml:jar:1.6-1:compile
[INFO] |  |     |  |  \- (batik:batik-util:jar:1.6-1:compile - omitted for duplicate)
[INFO] |  |     |  \- (xerces:xercesImpl:jar:2.5.0:compile - omitted for conflict with 2.2.1)
[INFO] |  |     \- batik:batik-parser:jar:1.6-1:compile
[INFO] |  |        \- (batik:batik-awt-util:jar:1.6-1:compile - omitted for duplicate)
[INFO] |  \- fop:fop:jar:0.20.5:compile
[INFO] |     +- batik:batik-1.5-fop:jar:0.20-5:compile
[INFO] |     +- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] |     +- (xalan:xalan:jar:2.4.1:compile - omitted for duplicate)
[INFO] |     +- xerces:xercesImpl:jar:2.2.1:compile
[INFO] |     \- avalon-framework:avalon-framework:jar:4.0:compile
[INFO] +- batik:batik-gui-util:jar:1.6-1:provided (scope not updated to compile)
[INFO] |  \- (batik:batik-ext:jar:1.6-1:provided - omitted for duplicate)
[INFO] +- batik:batik-ext:jar:1.6-1:provided
[INFO] |  \- xml-apis:xmlParserAPIs:jar:2.0.2:provided
[INFO] +- rhino:js:jar:1.5R4.1:provided
[INFO] \- xalan:xalan:jar:2.4.1:provided (scope not updated to compile)

Mavenを使用する場合、いくつかの依存関係を設定できます<scope>provided</scope>

たとえば、これらを問題なく除外できたので、約節約できました。1.6MB:

<dependencies>
...
    <dependency>
        <groupId>batik</groupId>
        <artifactId>batik-gui-util</artifactId>
        <version>1.6-1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>batik</groupId>
        <artifactId>batik-ext</artifactId>
        <version>1.6-1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>rhino</groupId>
        <artifactId>js</artifactId>
        <version>1.5R4.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>xalan</groupId>
        <artifactId>xalan</artifactId>
        <version>2.4.1</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

これらが最大の依存関係のようです:

http://repo.maven.apache.org/maven2/xerces/xercesImpl/2.2.1/xercesImpl-2.2.1.jar (816 KB at 851.9 KB/sec)
http://repo.maven.apache.org/maven2/xalan/xalan/2.4.1/xalan-2.4.1.jar (1007 KB at 479.7 KB/sec)
http://repo.maven.apache.org/maven2/fop/fop/0.20.5/fop-0.20.5.jar (1485 KB at 1011.7 KB/sec)
http://repo.maven.apache.org/maven2/batik/batik-1.5-fop/0.20-5/batik-1.5-fop-0.20-5.jar (2063 KB at 936.0 KB/sec)
于 2016-03-05T09:49:25.367 に答える
1

何を達成したいのか正確にはわかりませんが、ProGuardを使用すると、コードで使用されていない jar 内のクラスをフィルター処理できます。

于 2012-01-19T22:27:32.333 に答える