/** * File to incorporate as application.xml. * @param descr the descriptor file */ public void setAppxml(File descr) { deploymentDescriptor = descr; if (!deploymentDescriptor.exists()) { throw new BuildException( "Deployment descriptor: %s does not exist.", deploymentDescriptor); } // Create a ZipFileSet for this file, and pass it up. ZipFileSet fs = new ZipFileSet(); fs.setFile(deploymentDescriptor); fs.setFullpath(XML_DESCRIPTOR_PATH); super.addFileset(fs); }
File classesJar = new File(destDir, "WEB-INF/lib/classes.jar"); ZipFileSet zfs = new ZipFileSet(); zfs.setProject(prj); zfs.setSrc(archive); zfs.setIncludes("WEB-INF/classes/");
@RequestMapping("/starter.zip") @ResponseBody public ResponseEntity<byte[]> springZip(BasicProjectRequest basicRequest) throws IOException { ProjectRequest request = (ProjectRequest) basicRequest; File dir = this.projectGenerator.generateProjectStructure(request); File download = this.projectGenerator.createDistributionFile(dir, ".zip"); String wrapperScript = getWrapperScript(request); new File(dir, wrapperScript).setExecutable(true); Zip zip = new Zip(); zip.setProject(new Project()); zip.setDefaultexcludes(false); ZipFileSet set = new ZipFileSet(); set.setDir(dir); set.setFileMode("755"); set.setIncludes(wrapperScript); set.setDefaultexcludes(false); zip.addFileset(set); set = new ZipFileSet(); set.setDir(dir); set.setIncludes("**,"); set.setExcludes(wrapperScript); set.setDefaultexcludes(false); zip.addFileset(set); zip.setDestFile(download.getCanonicalFile()); zip.execute(); return upload(download, dir, generateFileName(request, "zip"), "application/zip"); }
/** * A ZipFileset accepts another ZipFileSet or a FileSet as reference * FileSets are often used by the war task for the lib attribute * @param p the project to use * @return the abstract fileset instance */ @Override protected AbstractFileSet getRef(Project p) { dieOnCircularReference(p); Object o = getRefid().getReferencedObject(p); if (o instanceof ZipFileSet) { return (AbstractFileSet) o; } if (o instanceof FileSet) { ZipFileSet zfs = new ZipFileSet((FileSet) o); configureFileSet(zfs); return zfs; } String msg = getRefid().getRefId() + " doesn\'t denote a zipfileset or a fileset"; throw new BuildException(msg); }
final ZipFileSet oldFiles = new ZipFileSet(); oldFiles.setProject(getProject()); oldFiles.setSrc(renamedFile); oldFiles.setDefaultexcludes(false); oldFiles.createExclude().setName(addedFile); oldFiles.getDirectoryScanner(getProject()); ((ZipScanner) ds).setEncoding(encoding);
/** Process groupfilesets */ private void processGroupFilesets() { // Add the files found in groupfileset to fileset for (FileSet fs : groupfilesets) { logWhenWriting("Processing groupfileset ", Project.MSG_VERBOSE); final FileScanner scanner = fs.getDirectoryScanner(getProject()); final File basedir = scanner.getBasedir(); for (String file : scanner.getIncludedFiles()) { logWhenWriting("Adding file " + file + " to fileset", Project.MSG_VERBOSE); final ZipFileSet zf = new ZipFileSet(); zf.setProject(getProject()); zf.setSrc(new File(basedir, file)); add(zf); filesetsFromGroupfilesets.add(zf); } } }
rezip.setDestFile(outputFile); rezip.setProject(new Project()); ZipFileSet z = new ZipFileSet(); z.setSrc(war); rezip.addZipfileset(z); throw new UnsupportedOperationException(hpi.getFile()+" is a directory and not packaged yet. this isn't supported"); z = new ZipFileSet(); z.setFile(hpi.getFile()); z.setFullpath("/WEB-INF/plugins/"+hpi.getArtifactId()+".hpi"); rezip.addZipfileset(z);
ZipFileSet zip = new ZipFileSet(); zip.setProject(getProject()); zip.setSrc(lib); zip.createExclude().setName("META-INF/**"); addZipfileset(zip);
Zip zip = new Zip(); zip.setDestFile(dest); ZipFileSet fs = new ZipFileSet(); fs.setDir(source); fs.setPrefix(serverName); fs.setProject(project); zip.addFileset(fs); archiver = zip;
ZipFileSet zipFileSet = new ZipFileSet(); zipFileSet.setSrc(classpathFileList[i]); zipFileSet.setIncludes(urlPath); super.addZipfileset(zipFileSet); return;
task.init(); task.setDestFile(new File(zipFilePath)); ZipFileSet zipFileSet = new ZipFileSet(); zipFileSet.setPrefix("WEB-INF/lib"); zipFileSet.setDir(new File(libsToAddDir)); task.addFileset(zipFileSet); task.setUpdate(true);
private Stream<ArchiveFileSet> streamArchives() { final List<ArchiveFileSet> l = new LinkedList<>(); for (final Resource r : zips) { l.add(configureArchive(new ZipFileSet(), r)); } for (final Resource r : tars) { l.add(configureArchive(new TarFileSet(), r)); } return l.stream(); }
private void updateSourceWar(File jspCompileDir) { // Finally need to merge the compiled jsps in War warTask = new War(); warTask.setProject(getProject()); warTask.setDestFile(war); warTask.setUpdate(true); ZipFileSet jspFiles = new ZipFileSet(); // The JSPs will be in the a well known location. The // app name from server.xml and the war file name will // be // in the path, the war name minus the .war extension // (if present) will also be used. jspFiles.setDir(jspCompileDir); warTask.addClasses(jspFiles); warTask.setTaskName(getTaskName()); warTask.execute(); }
/** * Adds a zipfileset to include in the META-INF directory. * * @param fs zipfileset to add */ public void addMetainf(ZipFileSet fs) { // We just set the prefix for this fileset, and pass it up. fs.setPrefix("META-INF/"); super.addFileset(fs); }
ZipFileSet fileSet = new ZipFileSet(); fileSet.setDir(fileToZip); fileSet.setPrefix(fileToZip.getPath());
/** * add files under WEB-INF/lib/ * @param fs the zip file set to add */ public void addLib(ZipFileSet fs) { // We just set the prefix for this fileset, and pass it up. fs.setPrefix("WEB-INF/lib/"); super.addFileset(fs); }
/** * set the deployment descriptor to use (WEB-INF/web.xml); * required unless <tt>update=true</tt> * @param descr the deployment descriptor file */ public void setWebxml(File descr) { deploymentDescriptor = descr; if (!deploymentDescriptor.exists()) { throw new BuildException("Deployment descriptor: does not exist.", deploymentDescriptor); } // Create a ZipFileSet for this file, and pass it up. ZipFileSet fs = new ZipFileSet(); fs.setFile(deploymentDescriptor); fs.setFullpath(XML_DESCRIPTOR_PATH); super.addFileset(fs); }
File classesJar = new File(destDir, "WEB-INF/lib/classes.jar"); ZipFileSet zfs = new ZipFileSet(); zfs.setProject(prj); zfs.setSrc(archive); zfs.setIncludes("WEB-INF/classes/");
/** * Adds zipfileset. * * @param fs zipfileset to add */ public void addArchives(ZipFileSet fs) { // We just set the prefix for this fileset, and pass it up. // Do we need to do this? LH fs.setPrefix("/"); super.addFileset(fs); }
private void processDescriptor(File xmlDtor, String xmlDtorName) { if (!xmlDtor.exists()) throw new BuildException("Deployment descriptor: " + xmlDtor + " does not exist."); // Add a new fileset for the DD. ZipFileSet fs = new ZipFileSet(); fs.setFile(xmlDtor); fs.setFullpath("META-INF/" + xmlDtorName); super.addFileset(fs); }