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

x33g5p2x  于2022-02-05 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(104)

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

Zip.setBasedir介绍

[英]Directory from which to archive files; optional.
[中]归档文件的目录;可选择的

代码示例

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

/**
 * Sets base directory for the archive.
 *
 * @param baseDir Base archive directory to set.
 */
@Override public void setBasedir(File baseDir) {
  super.setBasedir(baseDir);
  this.baseDir = baseDir;
}

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

Zip zip = new Zip();
zip.setBasedir(new File(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_ROOT_FOLDER));
zip.setDestFile(new File(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_ROOT_ZIP_FILE));
zip.setUpdate(true);
  zip.setBasedir(new File(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_BASE_FOLDER));
  zip.setDestFile(new File(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_BASE_ZIP_FILE));
  zip.setUpdate(true);

代码示例来源: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: stackoverflow.com

Project p = new Project();
p.init();
Zip zip = new Zip();
zip.setProject(p);
zip.setDestFile(zipFile); // a java.io.File for the zip you want to create
zip.setBasedir(new File("D:\\reports"));
zip.setIncludes("january/**");
zip.perform();

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

zip.setBasedir(getJonasRoot());
zip.setDestFile(new File(this.workdirectory, JONAS_ROOT_ZIP_FILE));
zip.setUpdate(true);
  zip.setBasedir(getJonasBase());
  zip.setDestFile(new File(this.workdirectory, JONAS_BASE_ZIP_FILE));
  zip.setUpdate(true);

相关文章