Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cross-project-issues-dev] Jars in jars is good citicenship?

John Arthorne wrote:

Thomas Hallgren wrote on 11/02/2007 10:55:00 AM:

> John Arthorne wrote:
> >
> > Having said that, altering the runtime structure of plugins to
> > workaround development time limitations seems to be a poor reason for
> > not doing this valuable optimization.
> I agree that having jar'ed plug-ins is of great value but is nested jars
> really an optimization? I might be wrong (haven't tested) but I doubt
> that any gain in performance, memory consumption, or even significant
> size on disk can be proven.

Well, it really depends on the situation. If a plugin contains a nested jar, plus thousands of other files, there is certainly performance gain in install time, disk space, etc, from jarring. The benefit of jarring tends to accumulate over a large body of plugins - it might be a small gain for a single plugin, but for an application with a 1000 plugins, it adds up.
Theoretically, that's true if all you consider is space on disk for the installed application. A large number of uncompressed files outside of the jars will waste some space on disk. On the other hand, in many cases performance might be better if the files are decompressed and unpacked.

In practice, I doubt that nested jars will ever be an optimization. If you have a high number of plug-ins with nested jars and if most of them has a large number of files outside of the jars, then yes, the space gained by compressing might be significant. But is it always favorable? Will we ever see an application assembled that way?

> > It's certainly not the case that all plugins that contain nested jars
> > cannot be jarred.
> Of course not. My point is that the since the compiler fails to
> recognize nested jars, any downstream project depending on such plug-ins
> have to go through the hassle that I described earlier. I'm questioning
> why that is recommended and why it's considered good citizenship.

I think the problem is that it's hard to come up with a simple recommendation that applies in all cases. Plugins with nested jars would probably need to be evaluated on a case by case basis to see what the best solution is. Sometimes a nested jar is fine (such as the common ant task case). Sometimes the right answer is to split the nested jars out into separate plugins. Perhaps as with the "should do" for ICU4J, it should instead say "Projects should have jarred plugins where appropriate", with a link to a document with more details on what "appropriate" is.


Yes, that sounds good. The document should explain that nested jars creates problems for projects that depend on the plug-in as soon as the compiler needs to see the content of such a jar in the classpath. In my experience, that is the common case and also a constant source of irritation.

- thomas

Back to the top