Minimize external libraries

This topic has 2 voices, contains 6 replies, and was last updated by  Dele Taylor 352 days ago.

Viewing 7 posts - 1 through 7 (of 7 total)
Author Posts
Author Posts
March 14, 2011 at 3:43 AM #371

March 14, 2011 at 3:43 AM #372

For my purposes, I have to minimize external libraries, since each one has to be sent to our security team for code review. Data Pipeline has quite a few external libraries and I’m not sure how many are actually needed for the product. Obviously some are important to the applications function, but perhaps some are not. Could you look at minimizing the external libraries? Here is what I have..

antlr
dom4j
itext
jxl
log4j
poi
poi-contrib
poi-ooxml
poi-ooxml-schemas
poi-scratchpad
xmlbeans

March 14, 2011 at 5:26 PM #373

Dele Taylor

Hi Jeff,

Here’s a breakdown of the external libraries, what they’re used for, and when they can be excluded:

antlr
– used in dynamic expression parsing
– can safely exclude if not doing something like http://northconcepts.com/data-pipeline/ … t-runtime/
itext
– PDF generation
– can safely exclude if not generating PDFs
log4j
– logging
– necessary, cannot be removed
dom4j, poi, poi-contrib, poi-ooxml, poi-ooxml-schemas, poi-scratchpad, xmlbeans
– Excel reading & writing
– can safely exclude if not working with Excel or if only using JXL provider (see below)
jxl
– alternate Excel provider
– can safely exclude if not used explicitly as in: new ExcelDocument(ExcelDocument.ProviderType.JXL)

Let me know if you need any more info.

Cheers,
Dele

March 15, 2011 at 2:11 AM #374

Thanks! This is very helpful.

June 1, 2011 at 12:17 AM #375

I posted this question to the POI group.. here are some answers. I’d be over the moon if we could trim POI down to the primary components needed to read Excel.

On Thu, 26 May 2011, Jeff G wrote:

I’m using POI strictly for *reading Excel xls & xlsx *documents. I’m using this as part of a Java Web Start app with somewhat low bandwidth. POI is by far my biggest size hog. Is there any way I can reduce the size of this? Are all these libraries needed? This is what I have…

dom4j, poi, poi-contrib, poi-ooxml, poi-ooxml-schemas, poi-scratchpad,
xmlbeans

Thanks, Jeff

—————————————–
Reply

If you’re just doing excel files, you can ditch poi-scratchpad and poi-contrib. If you’re happy to just work with .xls (not .xlsx), then you can cut it back to only the main poi jar. If you need to work with .xlsx files, then you need the xml related jars, the poi-ooxml jar, and the cut down schemas (poi-ooxml-schemas). You might be able to shrink the ooxml-schemas file by excluding the word and powerpoint related bits, ditto cutting out the xwpf and xslf parts of poi-ooxml, not sure how much that’d save.

Nick

—————————————–
Reply

The poi-ooxml-schemas jar is built from the unit test coverage, you reduce that by giving up unit tests. You can delete them from the directory tree.

You’ll need a source distro and then you’ll need to delete the parts of the directory tree you don’t need. It should be clear what is what, you’ll focus on keeping XSSF, HSSF, SS, POIFS, OOXML bases classes…

You’ll then need to do your own build with ant.

http://poi.apache.org/howtobuild.html

Regards,
Dave

June 1, 2011 at 5:30 PM #376

Dele Taylor

Jeff,

It looks like you received some good advice in the POI group.

Based on their advice, I suggest you consider testing if your app works with only the necessary jars (log4j-1.2.15.jar, poi-3.6-20091214.jar, poi-ooxml-3.6-20091214.jar, poi-ooxml-schemas-3.6-20091214.jar, xmlbeans-2.3.0.jar). After that, you could experiment with removing whole packages or folders. For example:
- orgopenxmlformatsschemasdrawingml
- orgopenxmlformatsschemaspresentationml
- orgopenxmlformatsschemaswordprocessingml
- orgapachepoixwpf
- orgapachepoixslf

Dele

June 1, 2011 at 8:54 PM #377

Dele Taylor

Jeff,

There’s a promising Source Forge project you might try here (http://sourceforge.net/projects/proguard/). I haven’t used ProGuard myself, but it’s description — removes unused classes, fields, methods, and attributes — sounds helpful.

If it works as advertised, you might be able to create a really tight distribution :)

Cheers,
Dele

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.