gpt4 book ai didi

org.apache.tools.ant.types.ZipFileSet类的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 22:40:49 28 4
gpt4 key购买 nike

本文整理了Java中org.apache.tools.ant.types.ZipFileSet类的一些代码示例,展示了ZipFileSet类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipFileSet类的具体详情如下:
包路径:org.apache.tools.ant.types.ZipFileSet
类名称:ZipFileSet

ZipFileSet介绍

[英]A ZipFileSet is a FileSet with extra attributes useful in the context of Zip/Jar tasks. A ZipFileSet extends FileSets with the ability to extract a subset of the entries of a Zip file for inclusion in another Zip file. It also includes a prefix attribute which is prepended to each entry in the output Zip file. Since ant 1.6 ZipFileSet can be defined with an id and referenced in packaging tasks
[中]ZipFileSet是一个具有额外属性的文件集,在Zip/Jar任务的上下文中非常有用。ZipFileSet扩展了文件集,能够提取Zip文件的一个子集条目以包含在另一个Zip文件中。它还包括一个前缀属性,该属性在输出Zip文件中的每个条目前面。因为ant 1.6 ZipFileSet可以用id定义,并在打包任务中引用

代码示例

代码示例来源:origin: org.apache.ant/ant

/**
 * 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);
}

代码示例来源:origin: jenkinsci/jenkins

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/");

代码示例来源:origin: spring-io/initializr

@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");
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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);
}

代码示例来源:origin: org.apache.ant/ant

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);

代码示例来源:origin: org.apache.ant/ant

/** 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);
    }
  }
}

代码示例来源:origin: jenkinsci/maven-hpi-plugin

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);

代码示例来源:origin: net.sf.antenna/antenna

ZipFileSet zip = new ZipFileSet();
zip.setProject(getProject());
zip.setSrc(lib);
zip.createExclude().setName("META-INF/**");
addZipfileset(zip);

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

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;

代码示例来源:origin: org.mobicents.servers.jainslee.core/ant-tasks

ZipFileSet zipFileSet = new ZipFileSet();
zipFileSet.setSrc(classpathFileList[i]);
zipFileSet.setIncludes(urlPath);
super.addZipfileset(zipFileSet);
return;

代码示例来源:origin: stackoverflow.com

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);

代码示例来源:origin: org.apache.ant/ant

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();
}

代码示例来源:origin: net.wasdev.wlp.ant/wlp-anttasks

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();
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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);
}

代码示例来源:origin: stackoverflow.com

ZipFileSet fileSet = new ZipFileSet();
fileSet.setDir(fileToZip);
fileSet.setPrefix(fileToZip.getPath());

代码示例来源:origin: org.apache.ant/ant

/**
 * 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);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * 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);
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

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/");

代码示例来源:origin: org.apache.ant/ant

/**
 * 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);
}

代码示例来源:origin: org.mobicents.servers.jainslee.core/ant-tasks

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);
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com