Easy way to use extracted jars in my build..?

Hi,

I think when fusing many jars into a single jar (using ziptree) there is a big performance penalty to pay compared to reading the same content being extracted from the disk? Am I wrong? Especially external dependencies never change in my case so I could extract all jars a single time and use the files directly from there on when creating a fat-jar.

At some point in my build I need to create a single jar. From the subprojects I get the compiled classes and resources directly from the build folder in order to avoid using the project-jars. With external module jars I am out of luck though. So far I incorporate them in the fat-jar using ziptree. Is there an official Gradle supported way to extract external jars and use them in their extracted form from there on? Or is the increase in performance so small that it doesn’t make sense?

First thing to do is to measure if sourcing from exploded archives gives any performance advantage. Gradle’s dependency cache doesn’t currently support caching archives in their exploded form.

Hi Carsten,

Have you looked at Shadow Jar Gradle Plugin? It uses ‘JarInputStream’ and ‘JarOutputStream’ to avoid hitting the disk.