elharo commented on issue #526: URL: https://github.com/apache/maven-war-plugin/issues/526#issuecomment-5084920407
### Issue Overview & Context This issue (originally **MWAR-446**, GitHub issue **#526**) requests an enhancement to allow library dependencies (`.jar` files in `WEB-INF/lib`) to be packaged into the WAR using the ZIP `STORED` method (0% compression) rather than the default `DEFLATED` method. Because `.jar` files are already compressed archives, applying `DEFLATED` compression to them a second time during the WAR packaging phase yields negligible file size reduction and wastes CPU cycles. More importantly, when nested JARs are `STORED` rather than `DEFLATED`, specialized classloaders and execution environments can memory-map and read the nested archives directly from disk via byte offsets, eliminating the overhead of extracting them to a temporary file system directory at runtime. --- ### Is it still accurate? **Yes, the technical description is accurate.** The `maven-war-plugin` delegates archive creation to `maven-archiver` and `plexus-archiver`. By default, these components compress all files added to the archive unless instructed otherwise. Currently, the WAR plugin does not expose granular configuration to selectively apply the `STORED` method specifically to the `WEB-INF/lib` payload while retaining `DEFLATED` compression for text-based resources (such as HTML, CSS, JS, and XML files). --- ### Should it be fixed or closed? **It should be fixed.** #### Reasons to Implement: 1. **Build Performance:** Skipping the deflation phase for already-compressed binary files reduces CPU utilization and speeds up the packaging phase of the build, particularly for large applications with numerous dependencies. 2. **Runtime Efficiency:** `STORED` nested JARs enable zero-copy operations and direct classloading. This is a proven architectural optimization utilized extensively by modern frameworks (e.g., Spring Boot's fat JAR packaging requires nested libraries to be `STORED` to function efficiently). 3. **Ecosystem Consistency:** Similar optimizations have been requested or implemented in related Apache Maven plugins (such as `maven-ear-plugin` via MEAR-306). Providing this functionality in the WAR plugin brings it up to par with modern Java packaging requirements. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
