New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explode WAR instead of working on exploded WAR directory for Maven #1091
Comments
FYI @edrandall |
(Redirected from Jib seems to strip .war file META-INF/ contents from image #2064) It's been a long-standing convention in all of our web applications (we have a large number) that we store versioning information about the build within the MANIFEST.MF. We have an API which makes this available to monitoring and healthcheck systems. We absolutely need this information present in the build as we migrate to cloud. META-INF/MANIFEST.MF is part of the .jar file spec which, whilst "optional", is pretty much guaranteed to be present, it's designed for storing exactly this type information. Digital signatues are also stored in the META-INF/ directory. Ref. https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html and anyone using them will require this. Further, this is required by anyone using the extension mechanism. The Servlet Spec 2.4 SRV.9.7.1 (my emphasis on the must):
Just curious, where is it documented that Jib actually changes the deployed files in this way, a brief search found nothing (not even this ticket)? |
Thanks for the detailed explanation. That makes sense. Jib doesn't change the deployed files. It is just that by default, Jib is supposed to put exploded WAR contents, but because of this issue that it is using the intermediate exploded WAR directory prepared by Maven (whose contents are often same as the final WAR) instead of actually exploding the final WAR, incomplete BTW, Jib Gradle does explode the final WAR, so this issue is present only for Maven. |
Thanks - so it's something of a side-effect of Jib doing this and the order in which Maven builds things, have I got that right? |
Yeah, Maven prepares exploded WAR contents in a build output directory before finally zipping them up into a WAR file, and we've been lazy to use that intermediate directory instead of unzipping the WAR ourselves. This works in many cases, as the contents are often same except for files like This should be easy to fix, so I will see if we can fix this before our next release. In the meantime, if you have a Gradle project, you may try Jib Gradle just to see if it works as desired. |
The following maven 'hack' seems to provide a crude workaround, by extracting the META-INF/ from the war into the working dir after packaging but before the Jib goal executes:
|
@edrandall @joelhandwell @Daiki-Kawanuma @cessien @kurczynski @CauchyPeano We've released v1.7.0 with this fix! |
Explode the WAR file rather than using this directory. The contents of the final WAR may be different from this directory (it's possible to include or exclude files when packaging a WAR. Also the exploded WAR directory is configurable with
<webappDirectory>
and may not be atbuild.getFinalName()
.https://github.com/GoogleContainerTools/jib/pull/1068/files#r221696396
The text was updated successfully, but these errors were encountered: