Fix slow copies of module jar files

Currenty when the manifest needs to be updated the jar is copied JarEntry for JarEntry.
This is alos done only byte by byte, and therefore extremely slow, even on fast drives.
This could be sped up by using a byte[] (maybe size of 8192) to copy the entries in batches.

If one looks into the source ocde for JarOuputstream, and especially the base DeflaterOutputstream,
the internal buffer is only 512 elements large and not accessible from the JarOuotputStream contructor.

Instead what is done in this branch is
1. to copy the whole jar in one go.
2. Read the manifest from the copied jar and decide to patch it or not
3. If so just create the JarOuputStream with the modified manifest and it will get written to the jar an nor JarEntries have to be touched.

In a Multi-Module based  project with several large jar files (due to contained resources) the build speed went up  by almost 30 %.
One extremely large jar saw its copy time reduced from 30 seconds down to 5 seconds (all tested on a Samsung 970 EVO nvme ssd)

I tried to match the existing coding style. The style change introduced was the usage of try-with-resources but that should not be an issue because the minimum java version supported is 1.7.
1 file changed
tree: 21af0d6c0ecc15f2a83b1f8f1b3b2e710fce9a2e
  1. src/
  2. .gitignore
  3. Jenkinsfile.groovy
  4. LICENSE
  5. NOTICE
  6. pom.xml
  7. README.md