I am trying to create a jar file, but am using a zip task as the jar file contains no java code. To complete the jar I need to create a manifest and include this into the archive, xomething like the following:
the manifest file created appears in the build directory, but then disappears again (the Thread.sleep() allows you to see this)
the manifest file isn’t included in the archive
Does the file have to have a relative path to be included? Is there something that is cleaning up the files in the build directory? Is the archive only being assembled after the file has been deleted?
If I simply use a relative path then it works fine, but leaves the ‘temporary’ manifest file in the source tree, which isn’t good either.
If the file is disappearing, it might be because you’re invoking something like ‘clean webjar’. Because your createManifest() method is being called during the task configuration phase of the ‘webjar’ zip task, a call to ‘clean’ will delete it(and the entire build directory) during the task execution phase. If you create your manifest file(assuming it needs to be dynamically generated) in a separate task, you can get the behaviour that you’re looking for.
Thanks for the clarification. In the end I went back to using the java plugin and the standard jar task, as I needed too many workarounds. This information will still be useful, though, as there are some other files that need to be dynamically generated.