org.codehaus.plexus.util.FileUtils.forceMkdir()方法的使用及代码示例

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

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

FileUtils.forceMkdir介绍

[英]Make a directory.
[中]制作一个目录。

代码示例

代码示例来源:origin: apache/incubator-gobblin

private Path createDownloadDir(String workDir, String fileUrl) {
 Path downloadDirPath = Paths.get(workDir, DOWNLOAD_DIR);
 File downloadDirFile = downloadDirPath.toFile();
 try {
  Log.info(String.format("Creating download dir %s", downloadDirFile.toPath().toString()));
  FileUtils.forceMkdir(downloadDirFile);
 } catch (IOException e) {
  throw new RuntimeException(String
    .format("Unable to create download location for archive: %s at %s", fileUrl, downloadDirPath.toString()));
 }
 Log.info(String.format("Created download dir %s", downloadDirFile.toPath().toString()));
 return downloadDirPath;
}

代码示例来源:origin: apache/incubator-druid

FileUtils.forceMkdir(firehoseTempDir);

代码示例来源:origin: org.apache.gobblin/gobblin-example

private Path createDownloadDir(String workDir, String fileUrl) {
 Path downloadDirPath = Paths.get(workDir, DOWNLOAD_DIR);
 File downloadDirFile = downloadDirPath.toFile();
 try {
  Log.info(String.format("Creating download dir %s", downloadDirFile.toPath().toString()));
  FileUtils.forceMkdir(downloadDirFile);
 } catch (IOException e) {
  throw new RuntimeException(String
    .format("Unable to create download location for archive: %s at %s", fileUrl, downloadDirPath.toString()));
 }
 Log.info(String.format("Created download dir %s", downloadDirFile.toPath().toString()));
 return downloadDirPath;
}

代码示例来源:origin: org.sonatype.nexus/nexus-app

private File forceMkdir( final File directory )
{
  try
  {
    FileUtils.forceMkdir( directory );
    return directory;
  }
  catch ( IOException e )
  {
    final String message =
      "\r\n******************************************************************************\r\n"
        + "* Could not create directory [ "
        + directory
        + "]!!!! *\r\n"
        + "* Nexus cannot function properly until the process has read+write permissions to this folder *\r\n"
        + "******************************************************************************";
    getLogger().error( message );
    throw Throwables.propagate( e );
  }
}

代码示例来源:origin: org.codehaus.mojo/aspectj-maven-plugin

/**
 * Creates a file that can be used as input to the ajc compiler using the -argdfile flag.
 * Each line in these files should contain one option or filename.
 * Comments, as in Java, start with // and extend to the end of the line.
 *
 * @param arguments All arguments passed to ajc in this run
 * @param fileName the filename of the argfile
 * @param outputDir the build output area.
 * @throws IOException
 */
public static void writeBuildConfigToFile( List<String> arguments, String fileName, File outputDir )
  throws IOException
{
  FileUtils.forceMkdir( outputDir );
  File argFile = new File( outputDir, fileName );
  argFile.getParentFile().mkdirs();
  argFile.createNewFile();
  BufferedWriter writer = new BufferedWriter( new FileWriter( argFile ) );
  for ( String argument : arguments )
  {
    writer.write( argument );
    writer.newLine();
  }
  writer.flush();
  writer.close();
}

代码示例来源:origin: mojohaus/aspectj-maven-plugin

/**
 * Creates a file that can be used as input to the ajc compiler using the -argdfile flag.
 * Each line in these files should contain one option or filename.
 * Comments, as in Java, start with // and extend to the end of the line.
 *
 * @param arguments All arguments passed to ajc in this run
 * @param fileName the filename of the argfile
 * @param outputDir the build output area.
 * @throws IOException
 */
public static void writeBuildConfigToFile( List<String> arguments, String fileName, File outputDir )
  throws IOException
{
  FileUtils.forceMkdir( outputDir );
  File argFile = new File( outputDir, fileName );
  argFile.getParentFile().mkdirs();
  argFile.createNewFile();
  BufferedWriter writer = new BufferedWriter( new FileWriter( argFile ) );
  for ( String argument : arguments )
  {
    writer.write( argument );
    writer.newLine();
  }
  writer.flush();
  writer.close();
}

代码示例来源:origin: org.codehaus.plexus/plexus-component-metadata

private void writeDescriptor( ComponentSetDescriptor desc, File outputFile )
    throws Exception
  {
    assert desc != null;
    assert outputFile != null;

    FileUtils.forceMkdir( outputFile.getParentFile() );

    BufferedWriter output = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( outputFile ), "UTF-8" ) );

    try
    {
      writer.writeDescriptorSet( output, desc, false );
      output.flush();
    }
    finally
    {
      IOUtil.close( output );
    }

    getLogger().debug( "Wrote: " + outputFile );
  }
}

代码示例来源:origin: no.arktekk.unix/unix-common

FileUtils.forceMkdir( to.getParentFile() );

代码示例来源:origin: STAMP-project/dspot

System.out.println(output);
try {
  FileUtils.forceMkdir(new File(InputConfiguration.get().getOutputDirectory() + "/" +
      this.currentClassTestToBeAmplified.getQualifiedName()));
} catch (Exception e) {

代码示例来源:origin: org.kuali.common/kuali-util

@Override
public void execute() {
  if (skip) {
    return;
  }
  // Make sure we are configured correctly
  Assert.notNull(srcDir, "srcDir is null");
  Assert.notNull(dstDir, "dstDir is null");
  // Source directory has to exist already. We'll create destination directory if necessary
  Assert.isExistingDir(srcDir, "srcDir is not an existing directory");
  try {
    // Null safe conversion of the lists to CSV
    String includesCSV = StringUtils.trimToNull(CollectionUtils.getCSV(includes));
    String excludesCSV = StringUtils.trimToNull(CollectionUtils.getCSV(excludes));
    // Make sure we can create the destination directory
    FileUtils.forceMkdir(dstDir);
    // Show what we are up to
    logCopy();
    // Copy files from src to dst
    FileUtils.copyDirectory(srcDir, dstDir, includesCSV, excludesCSV);
  } catch (IOException e) {
    throw new IllegalStateException("Unexpected IO error", e);
  }
}

代码示例来源:origin: mojohaus/appassembler

FileUtils.forceMkdir( request.getOutputDirectory() );

代码示例来源:origin: org.codehaus.mojo/appassembler-maven-plugin

FileUtils.forceMkdir( request.getOutputDirectory() );

代码示例来源:origin: net.flexmojos.oss/flexmojos-maven-plugin

try
  FileUtils.forceMkdir( outputFile.getParentFile() );
  output = new FileWriter( outputFile );
  IOUtil.copy( "<?xml version=\"1.0\"?>", output );

代码示例来源:origin: org.mule.tools/bobberplus

outFile = new File(outputDirectory, wout.toString());
getLogger().debug(outFile.getAbsolutePath());
FileUtils.forceMkdir(outFile.getParentFile());
getLogger().debug("Created directory: " + outFile.getParentFile() + ", Dir exists = " + outFile.getParentFile().exists());

代码示例来源:origin: org.apache.geronimo.genesis.plugins/plugin-support

FileUtils.forceMkdir(workingDirectory);
java.setDir(workingDirectory);
  File file = getLogFile();
  log.info("Redirecting output to: " + file);
  FileUtils.forceMkdir(file.getParentFile());

代码示例来源:origin: org.codehaus.mojo/plugin-support

FileUtils.forceMkdir(workingDirectory);
java.setDir(workingDirectory);
  File file = getLogFile();
  log.info("Redirecting output to: " + file);
  FileUtils.forceMkdir(file.getParentFile());

代码示例来源:origin: org.apache.druid/druid-indexing-service

FileUtils.forceMkdir(firehoseTempDir);

代码示例来源:origin: io.druid/druid-indexing-service

FileUtils.forceMkdir(firehoseTempDir);

代码示例来源:origin: org.codehaus.mojo/appassembler-maven-plugin

FileUtils.forceMkdir( request.getOutputDirectory() );

代码示例来源:origin: mojohaus/appassembler

FileUtils.forceMkdir( request.getOutputDirectory() );

相关文章