org.apache.maven.shared.utils.io.FileUtils.deleteDirectory()方法的使用及代码示例

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

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

FileUtils.deleteDirectory介绍

[英]Recursively delete a directory.
[中]递归地删除目录。

代码示例

代码示例来源:origin: org.apache.maven.shared/maven-shared-utils

/**
 * Recursively delete a directory.
 *
 * @param directory a directory
 * @throws IOException if any
 */
public static void deleteDirectory( @Nonnull final String directory )
  throws IOException
{
  deleteDirectory( new File( directory ) );
}

代码示例来源:origin: org.apache.maven.shared/maven-verifier

/**
 * Deletes the specified directory.
 *
 * @param path The path to the directory to delete, relative to the base directory, must not be <code>null</code>.
 * @throws IOException If the directory could not be deleted.
 * @since 1.2
 */
public void deleteDirectory( String path )
  throws IOException
{
  FileUtils.deleteDirectory( new File( getBasedir(), path ) );
}

代码示例来源:origin: org.apache.maven.shared/maven-verifier

public static File simpleExtractResources( Class<?> cl, String resourcePath )
  throws IOException
{
  String tempDirPath = System.getProperty( "maven.test.tmpdir", System.getProperty( "java.io.tmpdir" ) );
  File tempDir = new File( tempDirPath );
  File testDir = new File( tempDir, resourcePath );
  FileUtils.deleteDirectory( testDir );
  testDir = ResourceExtractor.extractResourcePath( cl, resourcePath, tempDir, false );
  return testDir;
}

代码示例来源:origin: org.apache.maven.shared/maven-verifier

/**
 * Deletes all artifacts in the specified g:a:v from the local repository.
 *
 * @param gid     The group id whose artifacts should be deleted, must not be <code>null</code>.
 * @param aid     The artifact id whose artifacts should be deleted, must not be <code>null</code>.
 * @param version The (base) version whose artifacts should be deleted, must not be <code>null</code>.
 * @throws IOException If the artifacts could not be deleted.
 * @since 1.3
 */
public void deleteArtifacts( String gid, String aid, String version )
  throws IOException
{
  String path;
  if ( "default".equals( localRepoLayout ) )
  {
    path = gid.replace( '.', '/' ) + '/' + aid + '/' + version;
  }
  else
  {
    throw new IllegalStateException( "Unsupported repository layout: " + localRepoLayout );
  }
  FileUtils.deleteDirectory( new File( localRepo, path ) );
}

代码示例来源:origin: org.apache.maven.shared/maven-verifier

/**
 * Deletes all artifacts in the specified group id from the local repository.
 *
 * @param gid The group id whose artifacts should be deleted, must not be <code>null</code>.
 * @throws IOException If the artifacts could not be deleted.
 * @since 1.2
 */
public void deleteArtifacts( String gid )
  throws IOException
{
  String path;
  if ( "default".equals( localRepoLayout ) )
  {
    path = gid.replace( '.', '/' );
  }
  else if ( "legacy".equals( localRepoLayout ) )
  {
    path = gid;
  }
  else
  {
    throw new IllegalStateException( "Unsupported repository layout: " + localRepoLayout );
  }
  FileUtils.deleteDirectory( new File( localRepo, path ) );
}

代码示例来源:origin: org.apache.maven.shared/maven-shared-utils

/**
   * small helper method who deletes the given directory or file.
   *
   * @param targetFile
   * @throws IOException
   */
  private void deleteFileOrDir( File targetFile )
    throws IOException
  {
    if ( targetFile.isDirectory() )
    {
      FileUtils.deleteDirectory( targetFile );
    }
    else
    {
      FileUtils.delete( targetFile );
    }

  }
}

代码示例来源:origin: org.apache.maven.shared/maven-shared-utils

/**
 * Delete a file. If file is directory delete it and all sub-directories.
 *
 * @param file a file
 * @throws IOException if any
 */
public static void forceDelete( @Nonnull final File file )
  throws IOException
{
  if ( file.isDirectory() )
  {
    deleteDirectory( file );
  }
  else
  {
    /*
     * NOTE: Always try to delete the file even if it appears to be non-existent. This will ensure that a
     * symlink whose target does not exist is deleted, too.
     */
    boolean filePresent = file.getCanonicalFile().exists();
    if ( !deleteFile( file ) && filePresent )
    {
      final String message = "File " + file + " unable to be deleted.";
      throw new IOException( message );
    }
  }
}

代码示例来源:origin: org.apache.maven.shared/maven-verifier

FileUtils.deleteDirectory( f );

代码示例来源:origin: org.apache.maven.plugins/maven-assembly-plugin

FileUtils.deleteDirectory( tempRepo );

相关文章