The file you write doesn't have to be a complete manifest file; it can contain just enough information for the Jar tool to know where and what information to merge into the default manifest.
I have created Java Programme which is based on Swing-Servlet Communication.
Is there a Gradle way to update the contents of a JAR?
I couldn't see how to do this so have resorted to using an ant jar task (with update = true).
The basedir attribute is the reference directory from where to jar.
Note that file permissions will not be stored in the resulting jarfile.