private void writeManifest(ZipOutputStream zOut, Manifest manifest) throws IOException { StreamUtils.enumerationAsStream(manifest.getWarnings()) .forEach(warning -> log("Manifest warning: " + warning, Project.MSG_WARN)); zipDir((Resource) null, zOut, "META-INF/", ZipFileSet.DEFAULT_DIR_MODE, JAR_MARKER); // time to write the manifest ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(baos, Manifest.JAR_ENCODING); PrintWriter writer = new PrintWriter(osw); manifest.write(writer, flattenClassPaths); if (writer.checkError()) { throw new IOException("Encountered an error writing the manifest"); } writer.close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); try { super.zipFile(bais, zOut, MANIFEST_NAME, System.currentTimeMillis(), null, ZipFileSet.DEFAULT_FILE_MODE); } finally { // not really required FileUtils.close(bais); } super.initZipOutputStream(zOut); }
StreamUtils.enumerationAsStream(nestedManifest.getWarnings()) .forEach(e -> log("Manifest warning: " + e, Project.MSG_WARN)); try {