本文整理汇总了Java中org.codehaus.plexus.util.FileUtils.deleteDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.deleteDirectory方法的具体用法?Java FileUtils.deleteDirectory怎么用?Java FileUtils.deleteDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.plexus.util.FileUtils
的用法示例。
在下文中一共展示了FileUtils.deleteDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateOsxDirectoryWatcherPreExistingSubdir
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
@Test
public void validateOsxDirectoryWatcherPreExistingSubdir() throws Exception {
Assume.assumeTrue(System.getProperty("os.name").toLowerCase().contains("mac"));
File directory = new File(new File("").getAbsolutePath(), "target/directory");
FileUtils.deleteDirectory(directory);
directory.mkdirs();
//make a dir before the watch is started
File zupDir = Paths.get(directory.toString(), "zup").toFile();
zupDir.mkdir();
assertTrue(zupDir.exists());
//prep a new file for the watched directory
File fileInZupDir = new File(zupDir, "fileInZupDir.txt");
assertFalse(fileInZupDir.exists());
//write it to the zup subdirectory of the watched directory
Files.write(fileInZupDir.toPath(), "some data".getBytes());
assertTrue(fileInZupDir.exists());
//files are written and done, now start the watcher
runWatcher(directory.toPath(), new WatchablePath(directory.toPath()), new MacOSXListeningWatchService(), true);
}
示例2: getThreadFolder
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
private File getThreadFolder() throws MojoFailureException {
if(threadFolder != null) {
return threadFolder;
}
threadFolder = new File(project.getBuild().getDirectory(), "cucumber/threads");
try {
FileUtils.deleteDirectory(threadFolder);
} catch (IOException e) {
throw new MojoFailureException(
format("Cannot delete thread folder: %s", threadFolder
.getAbsolutePath()), e);
}
if(!threadFolder.mkdirs()) {
throw new MojoFailureException(
format("Could not create thread folder at: %s", threadFolder
.getAbsolutePath()));
}
return threadFolder;
}
示例3: execute
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
public void execute() throws MojoFailureException {
if (new SkipUtil().isSkip(this.getClass())) {
return;
}
if (wipeoutWorkspace)
{
getLog().info("Deleting the workspace directory: " + workspace);
if (workspace.exists()) {
try {
FileUtils.deleteDirectory(workspace);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
else
{
getLog().info("'wipeoutWorkspace' configuration property set to false - workspace will not be deleted");
}
}
示例4: execute
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
public void execute() throws MojoExecutionException, MojoFailureException {
// mvn
// org.apache.maven.plugins:maven-dependency-plugin:2.1:copy-dependencies
// -DoutputDirectory=${project.build.directory}/iib/classloader
executeMojo(plugin(groupId("org.apache.maven.plugins"), artifactId("maven-dependency-plugin"), version("2.8")), goal("copy-dependencies"), configuration(element(name("outputDirectory"),
project.getBuild().getDirectory() + "/dependency"), element(name("includeScope"), "runtime"), element(name("includeTypes"), "jar")),
executionEnvironment(project, session, buildPluginManager));
// delete the dependency-maven-plugin-markers directory
try {
FileUtils.deleteDirectory(new File(project.getBuild().getDirectory(), "dependency-maven-plugin-markers"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例5: deleteDirectoryOfPreviousRunIfExist
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
protected void deleteDirectoryOfPreviousRunIfExist( File directoryOfPreviousRun )
throws MojoExecutionException
{
if ( directoryOfPreviousRun.exists() )
{
try
{
FileUtils.deleteDirectory( directoryOfPreviousRun );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Failure while deleting " + directoryOfPreviousRun.getAbsolutePath(),
e );
}
}
}
示例6: removeDirectory
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void removeDirectory( File dir )
throws MojoExecutionException
{
if ( dir != null )
{
if ( dir.exists() && dir.isDirectory() )
{
getLogger().debug( "Deleting directory " + dir.getAbsolutePath() );
try
{
FileUtils.deleteDirectory( dir );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Could not delete directory: " + dir, e );
}
}
}
}
示例7: execute
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void execute() throws MojoExecutionException, MojoFailureException
{
if (skip)
{
getLog().info("Skipping cassandra: cassandra.skip==true");
return;
}
try
{
getLog().info("Deleting " + cassandraDir.getAbsolutePath());
FileUtils.deleteDirectory(cassandraDir);
} catch (IOException e)
{
if (failOnError)
{
throw new MojoFailureException(e.getLocalizedMessage(), e);
}
getLog().warn("Failed to delete " + cassandraDir.getAbsolutePath(), e);
}
}
示例8: createDirectory
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
/**
* Convenience method to successfully create a directory - or throw an exception if failing to create it.
*
* @param aDirectory The directory to create.
* @param cleanBeforeCreate if {@code true}, the directory and all its content will be deleted before being
* re-created. This will ensure that the created directory is really clean.
* @throws MojoExecutionException if the aDirectory could not be created (and/or cleaned).
*/
public static void createDirectory(final File aDirectory, final boolean cleanBeforeCreate)
throws MojoExecutionException {
// Check sanity
Validate.notNull(aDirectory, "aDirectory");
validateFileOrDirectoryName(aDirectory);
// Clean an existing directory?
if (cleanBeforeCreate) {
try {
FileUtils.deleteDirectory(aDirectory);
} catch (IOException e) {
throw new MojoExecutionException("Could not clean directory [" + getCanonicalPath(aDirectory) + "]", e);
}
}
// Now, make the required directory, if it does not already exist as a directory.
final boolean existsAsFile = aDirectory.exists() && aDirectory.isFile();
if (existsAsFile) {
throw new MojoExecutionException("[" + getCanonicalPath(aDirectory) + "] exists and is a file. "
+ "Cannot make directory");
} else if (!aDirectory.exists() && !aDirectory.mkdirs()) {
throw new MojoExecutionException("Could not create directory [" + getCanonicalPath(aDirectory) + "]");
}
}
示例9: generateConfdArtefacts
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
public static void generateConfdArtefacts(
PrepareContext context,
List<TemplateConfig> templates,
boolean forceDestToLocalFileSystemType,
Log log
) throws IOException {
File workingDirectory = context.getWorkingDirectory();
File templatesDirectory = new File(workingDirectory, TEMPLATES_DIRECTORY);
File tomlDirectory = new File(workingDirectory, CONF_D_DIRECTORY);
if (workingDirectory.exists()) {
FileUtils.deleteDirectory(workingDirectory);
}
FileUtils.mkdir(templatesDirectory.getAbsolutePath());
FileUtils.mkdir(tomlDirectory.getAbsolutePath());
for (TemplateConfig tc : templates) {
String tomlBaseName = FileUtils.basename(tc.getSrc().getAbsolutePath()) + TOML_FILE_EXT;
File tomlFile = new File(tomlDirectory, tomlBaseName);
writeToml(tomlFile, tc, forceDestToLocalFileSystemType);
FileUtils.copyFileToDirectory(tc.getSrc(), templatesDirectory);
warnAboutKeysExcludedByNamespace(tc, context, log);
}
}
示例10: removeDirectory
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
protected void removeDirectory( File directory )
throws MojoExecutionException
{
if ( directory.exists() )
{
try
{
this.getLog().info( "Removing " + directory );
FileUtils.deleteDirectory( directory );
}
catch ( IOException e )
{
throw new MojoExecutionException( e.getMessage(), e );
}
}
}
示例11: cleanLocalDir
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
private void cleanLocalDir(String dir) {
try {
FileUtils.deleteDirectory(new File(dir));
} catch (IOException e) {
logger.error("Failed cleaning local directory " + dir, e);
}
}
示例12: tearDown
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
@After
@Override
public void tearDown()
throws Exception
{
FileUtils.deleteDirectory( repoDir );
assertFalse( repoDir.exists() );
super.tearDown();
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:12,代码来源:ArchivaRepositoryScanningTaskExecutorAbstractTest.java
示例13: deleteStoreFolder
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
private void deleteStoreFolder() throws MojoFailureException {
try {
final File goStoreFolder = new File(getStoreFolder());
if (goStoreFolder.isDirectory()) {
getLog().info("Deleting the Store Folder : " + goStoreFolder);
FileUtils.deleteDirectory(goStoreFolder);
} else {
getLog().info("The Store Folder does not found : " + goStoreFolder);
}
} catch (IOException ex) {
throw new MojoFailureException("Can't delete the Store Folder", ex);
}
}
示例14: validateOsxDirectoryWatcher
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
@Test
public void validateOsxDirectoryWatcher() throws Exception {
Assume.assumeTrue(System.getProperty("os.name").toLowerCase().contains("mac"));
File directory = new File(new File("").getAbsolutePath(), "target/directory");
FileUtils.deleteDirectory(directory);
directory.mkdirs();
runWatcher(directory.toPath(), new WatchablePath(directory.toPath()), new MacOSXListeningWatchService(), true);
}
示例15: validateJdkDirectoryWatcher
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
@Test
public void validateJdkDirectoryWatcher() throws Exception {
Assume.assumeFalse(System.getProperty("os.name").toLowerCase().contains("mac"));
File directory = new File(new File("").getAbsolutePath(), "target/directory");
FileUtils.deleteDirectory(directory);
directory.mkdirs();
runWatcher(directory.toPath(), directory.toPath(), FileSystems.getDefault().newWatchService(), false);
}