private void addFilesToArchive ( ZipArchiver archiver , File sourceDir ) throws Exception { File generatedPackageFile = new File ( sourceDir , PACKAGE_XML ) ; if ( generatedPackageFile . exists ( ) ) { generatedPackageFile . delete ( ) ; } archiver . addDirectory ( sourceDir , getIncludes ( ) , getExcludes ( ) ) ; generatePackageXml ( generatedPackageFile , archiver . getFiles ( ) . values ( ) ) ; archiver . addFile ( generatedPackageFile , PACKAGE_XML ) ; }
Adds the files from a specific directory to an archive . It also builds a package . xml file based on that content which is also added to the archive .