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

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

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

FilePath.deleteRecursive介绍

[英]Deletes this directory, including all its contents recursively.
[中]递归删除此目录,包括其所有内容。

代码示例

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

listener.getLogger().println("Deleting " + ws + " on " + node.getDisplayName());
try {
  ws.deleteRecursive();
  WorkspaceList.tempDir(ws).deleteRecursive();
} catch (IOException x) {
  Functions.printStackTrace(x, listener.error("Failed to delete " + ws + " on " + node.getDisplayName()));

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

/**
 * Wipes out the workspace.
 */
@RequirePOST
public HttpResponse doDoWipeOutWorkspace() throws IOException, ServletException, InterruptedException {
  checkPermission(Functions.isWipeOutPermissionEnabled() ? WIPEOUT : BUILD);
  R b = getSomeBuildWithWorkspace();
  FilePath ws = b!=null ? b.getWorkspace() : null;
  if (ws!=null && getScm().processWorkspaceBeforeDeletion(this, ws, b.getBuiltOn())) {
    ws.deleteRecursive();
    for (WorkspaceListener wl : WorkspaceListener.all()) {
      wl.afterDelete(this);
    }
    return new HttpRedirect(".");
  } else {
    // If we get here, that means the SCM blocked the workspace deletion.
    return new ForwardToView(this,"wipeOutWorkspaceBlocked.jelly");
  }
}

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

private void deleteContentsRecursive(File file) throws IOException {
  File[] files = file.listFiles();
  if(files==null)
    return;     // the directory didn't exist in the first place
  for (File child : files)
    deleteRecursive(child);
}

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

public void run() {
    for (File dir : tbr)
      try {
        new FilePath(dir).deleteRecursive();
      } catch (IOException e) {
        e.printStackTrace();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
  }
}.start();

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

public void run() {
    for (File dir : tbr) {
      try {
        new FilePath(dir).deleteRecursive();
      } catch (IOException e) {
        e.printStackTrace();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}.start();

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

public void run() {
    for (File dir : tbr)
      try {
        new FilePath(dir).deleteRecursive();
      } catch (IOException e) {
        e.printStackTrace();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
  }
}.start();

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

private void delete(FilePath dir) throws InterruptedException {
  try {
    listener.getLogger().println("Deleting "+dir);
    dir.deleteRecursive();
  } catch (IOException e) {
    e.printStackTrace(listener.error("Failed to delete "+dir));
  }
}

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

private void delete(FilePath dir) throws InterruptedException {
  try {
    listener.getLogger().println("Deleting " + dir);
    dir.deleteRecursive();
  } catch (IOException e) {
    e.printStackTrace(listener.error("Failed to delete " + dir));
  }
}

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

private void delete(FilePath dir) throws InterruptedException {
  try {
    listener.getLogger().println("Deleting "+dir);
    dir.deleteRecursive();
  } catch (IOException e) {
    e.printStackTrace(listener.error("Failed to delete "+dir));
  }
}

代码示例来源:origin: io.jenkins.jenkinsfile-runner/setup

public void run() {
    for (File dir : tbr)
      try {
        new FilePath(dir).deleteRecursive();
      } catch (IOException e) {
        e.printStackTrace();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
  }
}.start();

代码示例来源:origin: jenkinsci/jenkinsfile-runner

public void run() {
    for (File dir : tbr)
      try {
        new FilePath(dir).deleteRecursive();
      } catch (IOException e) {
        e.printStackTrace();
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
  }
}.start();

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

private void delete(FilePath dir) throws InterruptedException {
  try {
    listener.getLogger().println("Deleting "+dir);
    dir.deleteRecursive();
  } catch (IOException e) {
    e.printStackTrace(listener.error("Failed to delete "+dir));
  }
}

代码示例来源:origin: jenkinsci/workflow-basic-steps-plugin

@Override
protected Void run() throws Exception {
  getContext().get(FilePath.class).deleteRecursive();
  return null;
}

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

@Override
  public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLogFile) throws IOException, InterruptedException {
    if (workspace.exists()) {
      listener.getLogger().println("Deleting existing workspace " + workspace.getRemote());
      workspace.deleteRecursive();
    }
    listener.getLogger().println("Staging "+zip);
    workspace.unzipFrom(zip.openStream());
    return true;
  }
}

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

@Override
  public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLogFile) throws IOException, InterruptedException {
    if (workspace.exists()) {
      listener.getLogger().println("Deleting existing workspace " + workspace.getRemote());
      workspace.deleteRecursive();
    }
    listener.getLogger().println("Staging " + zip);
    workspace.unzipFrom(zip.openStream());
    return true;
  }
}

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

@Override
  public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changeLogFile) throws IOException, InterruptedException {
    if (workspace.exists()) {
      listener.getLogger().println("Deleting existing workspace " + workspace.getRemote());
      workspace.deleteRecursive();
    }
    listener.getLogger().println("Staging "+zip);
    workspace.unzipFrom(zip.openStream());
    return true;
  }
}

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

public boolean cleanWorkspace() throws IOException, InterruptedException {
  checkPermission(BUILD);
  R b = getSomeBuildWithWorkspace();
  FilePath ws = b != null ? b.getWorkspace() : null;
  if (ws != null && getScm().processWorkspaceBeforeDeletion(this, ws, b.getBuiltOn())) {
    ws.deleteRecursive();
    return true;
  } else {
    // If we get here, that means the SCM blocked the workspace deletion.
    return false;
  }
}

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

public boolean cleanWorkspace() throws IOException, InterruptedException {
  checkPermission(BUILD);
  R b = getSomeBuildWithWorkspace();
  FilePath ws = b != null ? b.getWorkspace() : null;
  if (ws != null && getScm().processWorkspaceBeforeDeletion(this, ws, b.getBuiltOn())) {
    ws.deleteRecursive();
    return true;
  } else {
    // If we get here, that means the SCM blocked the workspace deletion.
    return false;
  }
}

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

public boolean cleanWorkspace() throws IOException, InterruptedException{
  checkPermission(BUILD);
  R b = getSomeBuildWithWorkspace();
  FilePath ws = b != null ? b.getWorkspace() : null;
  if (ws != null && getScm().processWorkspaceBeforeDeletion(this, ws, b.getBuiltOn())) {
    ws.deleteRecursive();
    return true;
  } else{
    // If we get here, that means the SCM blocked the workspace deletion.
    return false;
  }
}

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

public boolean cleanWorkspace() throws IOException, InterruptedException{
  checkPermission(BUILD);
  R b = getSomeBuildWithWorkspace();
  FilePath ws = b != null ? b.getWorkspace() : null;
  if (ws != null && getScm().processWorkspaceBeforeDeletion(this, ws, b.getBuiltOn())) {
    ws.deleteRecursive();
    return true;
  } else{
    // If we get here, that means the SCM blocked the workspace deletion.
    return false;
  }
}

相关文章