gpt4 book ai didi

org.apache.tools.ant.taskdefs.Zip.execute()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 05:28:49 32 4
gpt4 key购买 nike

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

Zip.execute介绍

[英]validate and build
[中]验证和构建

代码示例

代码示例来源:origin: apache/ignite

super.execute();

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

z.setDestFile(classesJar);
z.add(mapper);
z.execute();

代码示例来源: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.ow2.jonas.autostart/builder

zip.setProject(p);
try {
  zip.execute();
  this.jonasLocation.set(0, this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_ROOT_ZIP_FILE);
} catch (Exception e) {
  zip.setProject(p);
  try {
    zip.execute();
    this.jonasLocation.set(1, this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_BASE_ZIP_FILE);
  } catch (Exception e) {

代码示例来源:origin: org.jvnet.hudson.main/maven-plugin

/**
   * Copies a jar file from the master to slave.
   */
  private void copyJar(PrintStream log, FilePath dst, Class<?> representative, String seedName) throws IOException, InterruptedException {
    // in normal execution environment, the master should be loading 'representative' from this jar, so
    // in that way we can find it.
    File jar = Which.jarFile(representative);

    if(jar.isDirectory()) {
      // but during the development and unit test environment, we may be picking the class up from the classes dir
      Zip zip = new Zip();
      zip.setBasedir(jar);
      File t = File.createTempFile(seedName, "jar");
      t.delete();
      zip.setDestFile(t);
      zip.setProject(new Project());
      zip.execute();
      jar = t;
    }

    new FilePath(jar).copyTo(dst.child(seedName +".jar"));
    log.println("Copied "+seedName+".jar");
  }
}

代码示例来源:origin: org.ow2.jonas.autostart/builder

/**
 * Zip jonas-starter folder to jonas-starter.jar.
 */
public void zipStarter() {
  Project p = new Project();
  Zip zip = new Zip();
  zip.setBasedir(getStarterDefaultLocation());
  zip.setDestFile(new File(this.starterJarFileLocation.getAbsolutePath(), this.starterJarFileName));
  zip.setUpdate(true);
  zip.setProject(p);
  try {
    zip.execute();
    setStarterDefaultLocation(new File(this.starterJarFileLocation.getAbsolutePath(), this.starterJarFileName));
    renameStarterJarFile();
    this.output.write(this.starterJarFileName + " successfully created !");
    this.output.write("Location: " + this.starterDefaultLocation);
  } catch (Exception e) {
    this.output.write("Error in packaging jonas-starter : " + e.getMessage());
  }
}

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

/**
 * Copies a jar file from the master to slave.
 */
static FilePath copyJar(PrintStream log, FilePath dst, Class<?> representative, String seedName) throws IOException, InterruptedException {
  // in normal execution environment, the master should be loading 'representative' from this jar, so
  // in that way we can find it.
  File jar = Which.jarFile(representative);
  FilePath copiedJar = dst.child(seedName + ".jar");
  if (jar.isDirectory()) {
    // but during the development and unit test environment, we may be picking the class up from the classes dir
    Zip zip = new Zip();
    zip.setBasedir(jar);
    File t = File.createTempFile(seedName, "jar");
    t.delete();
    zip.setDestFile(t);
    zip.setProject(new Project());
    zip.execute();
    jar = t;
  } else if (copiedJar.exists() && copiedJar.digest().equals(Util.getDigestOf(jar))) {
    log.println(seedName + ".jar already up to date");
    return copiedJar;
  }
  // Theoretically could be a race condition on a multi-executor Windows slave; symptom would be an IOException during the build.
  // Could perhaps be solved by synchronizing on dst.getChannel() or similar.
  new FilePath(jar).copyTo(copiedJar);
  log.println("Copied " + seedName + ".jar");
  return copiedJar;
}

代码示例来源:origin: MarkGao11520/acmen-helper

/**
 * 执行压缩操作
 * @param srcPathName 需要被压缩的文件/文件夹
 * @param dest 生成的zip包的位置
 */
public static void doZipCompress(String srcPathName, String dest) {
  File srcdir = new File(srcPathName);
  if (!srcdir.exists()){
    throw new GlobalException(1 , srcPathName + "不存在" , null);
  }
  File zipFile = new File(dest);
  Project prj = new Project();
  Zip zip = new Zip();
  zip.setProject(prj);
  zip.setDestFile(zipFile);
  FileSet fileSet = new FileSet();
  fileSet.setProject(prj);
  fileSet.setDir(srcdir);
  //排除哪些文件或文件夹
  fileSet.setExcludes(".DS_Store");
  zip.addFileset(fileSet);
  zip.execute();
}

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

rezip.execute();
getLog().info("Generated "+outputFile);

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

z.setDestFile(classesJar);
z.add(mapper);
z.execute();

代码示例来源:origin: org.ow2.jonas.autostart/builder

zip.setProject(project);
try {
  zip.execute();
  addJonasLocation(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_ROOT_ZIP_FILE);
} catch (Exception e) {
  zip.setProject(project);
  try {
    zip.execute();
    addJonasLocation(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_BASE_ZIP_FILE);
  } catch (Exception e) {

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