Finer-grained control over entries as they're copied into a zip archive

I’m trying to write a custom Jar task that can set entry comments and the type of compression that’s used on a per-entry basis. It looks like a custom CopyAction could be a reasonable place to plug this in, but it’s internal API. Is there a way to do it that only uses public API or, failing that, could a public API be added that offers this level of control or allows something to be plugged in?

For the curious, the background to this request is a fairly significant rewrite of Spring Boot’s Gradle plugin to address several problems with the current version. We want to make the task that produces Spring Boot’s fat jar a custom Jar task. For performance reasons, Spring Boot’s fat jars contain jar files that must be stored rather than deflated. They also uses comments on individual entries to indicate that they should be automatically extracted at runtime. This is to work around limitations in libraries that make assumptions that don’t hold true when run from a nested jar.

The custom CopyAction route is probably your best bet, granted it is not a public API. This is the same technique used by the Shadow plugin. Also, if it makes you feel better, we have integration tests that exercise both these plugins so we would be aware of any breaking changes on our end.

Thanks, Mark. It’s certainly reassuring to know that there’s an integration test for Spring Boot’s plugin. I’ll go ahead and use CopyAction.