hudson.FilePath.deleteContents()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(160)

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

FilePath.deleteContents介绍

[英]Deletes all the contents of this directory, but not the directory itself
[中]删除此目录的所有内容,但不删除目录本身

代码示例

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

if (lastModified != 0 && sourceTimestamp == lastModified)
    return false;   // already up to date
  this.deleteContents();
} else {
  this.mkdirs();

代码示例来源:origin: org.jenkins-ci.plugins/git

/**
 * {@inheritDoc}
 */
@Override
public void beforeCheckout(GitSCM scm, Run<?, ?> build, GitClient git, TaskListener listener) throws IOException, InterruptedException, GitException {
  listener.getLogger().println("Wiping out workspace first.");
  git.getWorkTree().deleteContents();
}

代码示例来源:origin: org.hudsonci.plugins/cvs

/**
 * Performs cleaning workspace before checkout.
 *
 * @param moduleLocation ModuleLocation.
 * @param launcher Launcher.
 * @param dir workspace directory.
 * @param listener Listener.
 * @param buildDate date of the build than will be used for checkout operation with -D flag
 * @return true if checkout successful and false otherwise,
 *
 * @throws IOException if i/o errors.
 * @throws InterruptedException if interrupted.
 */
boolean cleanCheckout(ModuleLocation moduleLocation, Launcher launcher, FilePath dir, TaskListener listener,
             Date buildDate) throws InterruptedException, IOException {
  FilePath path = flatten ? dir.getParent() : dir;
  if (StringUtils.isNotEmpty(moduleLocation.getLocalDir())) {
    path = path.child(moduleLocation.getLocalDir());
  }
  try {
    path.deleteContents();
  } catch (IOException e) {
    LOGGER.log(Level.WARNING, "Cannot perform cleaning.");
    return false;
  } catch (InterruptedException e) {
    LOGGER.log(Level.WARNING, "Operation was interrupted");
    return false;
  }
  return checkout(moduleLocation, launcher, dir, listener, buildDate);
}

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

if (lastModified != 0 && sourceTimestamp == lastModified)
    return false;   // already up to date
  this.deleteContents();
} else {
  this.mkdirs();

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

if (! workspaces.exists(workspaceName)) {
  if ((!useUpdate || workspaceNamesToDelete.size() > 0) && localFolderPath.exists()) {
    localFolderPath.deleteContents();

代码示例来源:origin: hudson/hudson-2.x

if(timestamp.exists() && sourceTimestamp ==timestamp.lastModified())
    return false;   // already up to date
  this.deleteContents();
} else {
  this.mkdirs();

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

if(timestamp.exists() && sourceTimestamp ==timestamp.lastModified())
    return false;   // already up to date
  this.deleteContents();
} else {
  this.mkdirs();

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

if(timestamp.exists() && sourceTimestamp ==timestamp.lastModified())
    return false;   // already up to date
  this.deleteContents();
} else {
  this.mkdirs();

代码示例来源:origin: org.eclipse.hudson/hudson-core

return false;   // already up to date
  this.deleteContents();
} else {
  this.mkdirs();

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

return false;   // already up to date
  expected.deleteContents();
} else {
  expected.mkdirs();

代码示例来源:origin: org.jenkins-ci.plugins/docker-commons

if (timestamp.exists() && sourceTimestamp == timestamp.lastModified())
  return install;   // already up to date
install.deleteContents();

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

if (timestamp.exists() && sourceTimestamp == timestamp.lastModified())
  return install;   // already up to date
install.deleteContents();

代码示例来源:origin: org.hudsonci.plugins/git

listener.getLogger().println("Wiping out workspace first.");
try {
  ws.deleteContents();
} catch (InterruptedException e) {

代码示例来源:origin: org.jvnet.hudson.plugins/git

listener.getLogger().println("Wiping out workspace first.");
try {
  ws.deleteContents();
} catch (InterruptedException e) {

代码示例来源:origin: org.jvnet.hudson.plugins/cvs

private boolean checkout(Launcher launcher, FilePath dir, TaskListener listener, Date dt)
  throws IOException, InterruptedException {
  dir.deleteContents();
  ArgumentListBuilder cmd = new ArgumentListBuilder();
  cmd.add(getDescriptor().getCvsExeOrDefault(), noQuiet ? null : (debug ? "-t" : "-Q"), compression(), "-d",
    cvsroot, "co", "-P");
  if (branch != null) {
    cmd.add("-r", branch);
  }
  if (flatten) {
    cmd.add("-d", dir.getName());
  }
  configureDate(cmd, dt);
  cmd.add(getAllModulesNormalized());
  if (!run(launcher, cmd, listener, flatten ? dir.getParent() : dir)) {
    return false;
  }
  // clean up the sticky tag
  if (flatten) {
    dir.act(new StickyDateCleanUpTask());
  } else {
    for (String module : getAllModulesNormalized()) {
      dir.child(module).act(new StickyDateCleanUpTask());
    }
  }
  return true;
}

相关文章