You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Bernard Giannetti <th...@hotmail.com> on 2010/07/24 01:13:01 UTC

Minimising FOP footprint...

Hi,

I've noticed there's a lot of 3rd party JAR files bundled with FOP 1.0, notably:

avalon-framework-4.2.0.jar
batik-all-1.7.jar
commons-io-1.3.1.jar
commons-logging-1.0.4.jar
serializer-2.7.0.jar
xalan-2.7.0.jar
xercesImpl-2.7.1.jar
xml-apis-1.3.04.jar
xml-apis-ext-1.3.04.jar
xmlgraphics-commons-1.3.1.jar

and was wondering how many do I actually need?  If "all I'm doing" is using FOP to render an XML file using XSL template to a PDF, is there a way to trim out the unwanted JARs?

I can do a clean compile of my application, minus the JARs above listed in the classpath.  If I can the run my application and exercise the FOP part of it, does that tell me which JARs I can drop or am I being too naive?


On a somewhat related note, in doing an ANT build and setting the compiler args as follows:

<compilerarg value="-Xlint:deprecation,fallthrough,finally,path,unchecked" />

I get a few path warnings:

    [javac] warning: [path] bad path element "/lib/fop-hyph.jar": no such file or directory
    [javac] warning: [path] bad path element "/lib/xml-apis.jar": no such file or directory
    [javac] warning: [path] bad path element "/lib/xercesImpl.jar": no such file or directory
    [javac] warning: [path] bad path element "/lib/serializer.jar": no such file or directory
    [javac] warning: [path] bad path element "/lib/log4j.jar": no such file or directory

So are these old manifest entries that have not been updated to the new versions?  Can I safely remove these from the mainfests in the FOP JAR files?



Thanks,

Bernard.
 		 	   		  
_________________________________________________________________
Browse profiles for FREE! Meet local singles online.
http://clk.atdmt.com/NMN/go/150855801/direct/01/

RE: Minimising FOP footprint...

Posted by Dominik Stadler <do...@dynatrace.com>.
Hi, 

Currently Batik is listed hardcoded in all the service-files under META-INF/services inside fop.jar. You can remove support for SVG by removing these entries (you need to change the files inside the jar), then all the Batik/XML related jars are not necessary any more and can be omitted. 

After this we now use fop successfully with only the following jars:

Avalon-framework
commons-io
commons-logging
fop
xmlgraphics-common

Thanks... Dominik.

-----Original Message-----
From: Julien Aymé [mailto:julien.ayme@gmail.com] 
Sent: Montag, 26. Juli 2010 11:48
To: fop-users@xmlgraphics.apache.org
Subject: Re: Minimising FOP footprint...

2010/7/26 Jeremias Maerki <de...@jeremias-maerki.ch>:
> On 24.07.2010 01:13:01 Bernard Giannetti wrote:
>>
>> Hi,
>>
>> I've noticed there's a lot of 3rd party JAR files bundled with FOP 1.0, notably:
>>
>> avalon-framework-4.2.0.jar
>> batik-all-1.7.jar
>> commons-io-1.3.1.jar
>> commons-logging-1.0.4.jar
>> serializer-2.7.0.jar
>> xalan-2.7.0.jar
>> xercesImpl-2.7.1.jar
>> xml-apis-1.3.04.jar
>> xml-apis-ext-1.3.04.jar
>> xmlgraphics-commons-1.3.1.jar
>>
>> and was wondering how many do I actually need?  If "all I'm doing" is
>> using FOP to render an XML file using XSL template to a PDF, is there a
>> way to trim out the unwanted JARs?
>
> Batik is supposed to be optional but I'm not sure that it'll work
> properly without it. If you're not using SVG, try to omit it. If it
> works, you're fine. xml-apis-ext should be optional, too, if Batik is
> out of the picture. Xerces, Xalan, Serializer and xml-apis are not
> strictly required but some JDKs have buggy XML parsers or XSLT
> implementations so I always use my own verified JARs. The other JARs are
> mandatory.
>

You can try to use the smaller module jar from batik (I only need
batik-awt-util.jar) to reduce the overall footprint.
(You can build these jars with the target "jars" of Batik's Ant build).
Also, I think that FOP 1.0 uses xmlgraphics-commons 1.4 (instead of 1.3.1).

HTH,
Regards,
Julien

>> I can do a clean compile of my application, minus the JARs above listed
>> in the classpath.  If I can the run my application and exercise the FOP
>> part of it, does that tell me which JARs I can drop or am I being too
>> naive?
>
> In the end, just omit one of the ones I've listed and check if it works
> without. Trial & Error. ;-) If you get a ClassDefNotFoundError, you're
> missing a JAR.
>
>> On a somewhat related note, in doing an ANT build and setting the compiler args as follows:
>>
>> <compilerarg value="-Xlint:deprecation,fallthrough,finally,path,unchecked" />
>>
>> I get a few path warnings:
>>
>>     [javac] warning: [path] bad path element "/lib/fop-hyph.jar": no such file or directory
>>     [javac] warning: [path] bad path element "/lib/xml-apis.jar": no such file or directory
>>     [javac] warning: [path] bad path element "/lib/xercesImpl.jar": no such file or directory
>>     [javac] warning: [path] bad path element "/lib/serializer.jar": no such file or directory
>>     [javac] warning: [path] bad path element "/lib/log4j.jar": no such file or directory
>>
>> So are these old manifest entries that have not been updated to the new versions?  Can I safely remove these from the mainfests in the FOP JAR files?
>
> These were used solely for running FOP from the command-line. The
> classpath there is outdated and can be removed. Basically, we should
> remove it from FOP altogether, I think, since practically everyone uses
> our batch scripts if they run FOP from the command-line. Plus there is
> code in FOP, that constructs the classpath in code, rather than from the
> Manifest.
>
>>
>> Thanks,
>>
>> Bernard.
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Minimising FOP footprint...

Posted by Julien Aymé <ju...@gmail.com>.
2010/7/26 Jeremias Maerki <de...@jeremias-maerki.ch>:
> On 24.07.2010 01:13:01 Bernard Giannetti wrote:
>>
>> Hi,
>>
>> I've noticed there's a lot of 3rd party JAR files bundled with FOP 1.0, notably:
>>
>> avalon-framework-4.2.0.jar
>> batik-all-1.7.jar
>> commons-io-1.3.1.jar
>> commons-logging-1.0.4.jar
>> serializer-2.7.0.jar
>> xalan-2.7.0.jar
>> xercesImpl-2.7.1.jar
>> xml-apis-1.3.04.jar
>> xml-apis-ext-1.3.04.jar
>> xmlgraphics-commons-1.3.1.jar
>>
>> and was wondering how many do I actually need?  If "all I'm doing" is
>> using FOP to render an XML file using XSL template to a PDF, is there a
>> way to trim out the unwanted JARs?
>
> Batik is supposed to be optional but I'm not sure that it'll work
> properly without it. If you're not using SVG, try to omit it. If it
> works, you're fine. xml-apis-ext should be optional, too, if Batik is
> out of the picture. Xerces, Xalan, Serializer and xml-apis are not
> strictly required but some JDKs have buggy XML parsers or XSLT
> implementations so I always use my own verified JARs. The other JARs are
> mandatory.
>

You can try to use the smaller module jar from batik (I only need
batik-awt-util.jar) to reduce the overall footprint.
(You can build these jars with the target "jars" of Batik's Ant build).
Also, I think that FOP 1.0 uses xmlgraphics-commons 1.4 (instead of 1.3.1).

HTH,
Regards,
Julien

>> I can do a clean compile of my application, minus the JARs above listed
>> in the classpath.  If I can the run my application and exercise the FOP
>> part of it, does that tell me which JARs I can drop or am I being too
>> naive?
>
> In the end, just omit one of the ones I've listed and check if it works
> without. Trial & Error. ;-) If you get a ClassDefNotFoundError, you're
> missing a JAR.
>
>> On a somewhat related note, in doing an ANT build and setting the compiler args as follows:
>>
>> <compilerarg value="-Xlint:deprecation,fallthrough,finally,path,unchecked" />
>>
>> I get a few path warnings:
>>
>>     [javac] warning: [path] bad path element "/lib/fop-hyph.jar": no such file or directory
>>     [javac] warning: [path] bad path element "/lib/xml-apis.jar": no such file or directory
>>     [javac] warning: [path] bad path element "/lib/xercesImpl.jar": no such file or directory
>>     [javac] warning: [path] bad path element "/lib/serializer.jar": no such file or directory
>>     [javac] warning: [path] bad path element "/lib/log4j.jar": no such file or directory
>>
>> So are these old manifest entries that have not been updated to the new versions?  Can I safely remove these from the mainfests in the FOP JAR files?
>
> These were used solely for running FOP from the command-line. The
> classpath there is outdated and can be removed. Basically, we should
> remove it from FOP altogether, I think, since practically everyone uses
> our batch scripts if they run FOP from the command-line. Plus there is
> code in FOP, that constructs the classpath in code, rather than from the
> Manifest.
>
>>
>> Thanks,
>>
>> Bernard.
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Minimising FOP footprint...

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 24.07.2010 01:13:01 Bernard Giannetti wrote:
> 
> Hi,
> 
> I've noticed there's a lot of 3rd party JAR files bundled with FOP 1.0, notably:
> 
> avalon-framework-4.2.0.jar
> batik-all-1.7.jar
> commons-io-1.3.1.jar
> commons-logging-1.0.4.jar
> serializer-2.7.0.jar
> xalan-2.7.0.jar
> xercesImpl-2.7.1.jar
> xml-apis-1.3.04.jar
> xml-apis-ext-1.3.04.jar
> xmlgraphics-commons-1.3.1.jar
> 
> and was wondering how many do I actually need?  If "all I'm doing" is
> using FOP to render an XML file using XSL template to a PDF, is there a
> way to trim out the unwanted JARs?

Batik is supposed to be optional but I'm not sure that it'll work
properly without it. If you're not using SVG, try to omit it. If it
works, you're fine. xml-apis-ext should be optional, too, if Batik is
out of the picture. Xerces, Xalan, Serializer and xml-apis are not
strictly required but some JDKs have buggy XML parsers or XSLT
implementations so I always use my own verified JARs. The other JARs are
mandatory.

> I can do a clean compile of my application, minus the JARs above listed
> in the classpath.  If I can the run my application and exercise the FOP
> part of it, does that tell me which JARs I can drop or am I being too
> naive?

In the end, just omit one of the ones I've listed and check if it works
without. Trial & Error. ;-) If you get a ClassDefNotFoundError, you're
missing a JAR.

> On a somewhat related note, in doing an ANT build and setting the compiler args as follows:
> 
> <compilerarg value="-Xlint:deprecation,fallthrough,finally,path,unchecked" />
> 
> I get a few path warnings:
> 
>     [javac] warning: [path] bad path element "/lib/fop-hyph.jar": no such file or directory
>     [javac] warning: [path] bad path element "/lib/xml-apis.jar": no such file or directory
>     [javac] warning: [path] bad path element "/lib/xercesImpl.jar": no such file or directory
>     [javac] warning: [path] bad path element "/lib/serializer.jar": no such file or directory
>     [javac] warning: [path] bad path element "/lib/log4j.jar": no such file or directory
> 
> So are these old manifest entries that have not been updated to the new versions?  Can I safely remove these from the mainfests in the FOP JAR files?

These were used solely for running FOP from the command-line. The
classpath there is outdated and can be removed. Basically, we should
remove it from FOP altogether, I think, since practically everyone uses
our batch scripts if they run FOP from the command-line. Plus there is
code in FOP, that constructs the classpath in code, rather than from the
Manifest.

> 
> Thanks,
> 
> Bernard.


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org