本文整理了Java中org.codehaus.plexus.util.FileUtils.copyFileToDirectory()
方法的一些代码示例,展示了FileUtils.copyFileToDirectory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.copyFileToDirectory()
方法的具体详情如下:
包路径:org.codehaus.plexus.util.FileUtils
类名称:FileUtils
方法名:copyFileToDirectory
[英]Copy file from source to destination. If destinationDirectory
does not exist, it (and any parent directories) will be created. If a file source
in destinationDirectory
exists, it will be overwritten.
[中]将文件从源复制到目标。如果destinationDirectory
不存在,将创建它(和任何父目录)。如果destinationDirectory
中存在文件source
,则该文件将被覆盖。
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* Copy file from source to destination. If <code>destinationDirectory</code> does not exist, it (and any parent
* directories) will be created. If a file <code>source</code> in <code>destinationDirectory</code> exists, it will
* be overwritten.
*
* @param source An existing <code>File</code> to copy.
* @param destinationDirectory A directory to copy <code>source</code> into.
* @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file.
* @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory.
* @throws IOException if <code>source</code> does not exist, the file in <code>destinationDirectory</code> cannot
* be written to, or an IO error occurs during copying.
*/
public static void copyFileToDirectory( final String source, final String destinationDirectory )
throws IOException
{
copyFileToDirectory( new File( source ), new File( destinationDirectory ) );
}
代码示例来源:origin: org.codehaus.plexus/plexus-utils
copyFileToDirectory( file, destination );
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* Copy a directory to an other one.
*
* @param sourceDirectory the source dir
* @param destinationDirectory the target dir
* @param includes include pattern
* @param excludes exclude pattern
* @throws IOException if any
* @see #getFiles(File, String, String)
*/
public static void copyDirectory( File sourceDirectory, File destinationDirectory, String includes,
String excludes )
throws IOException
{
if ( !sourceDirectory.exists() )
{
return;
}
List<File> files = getFiles( sourceDirectory, includes, excludes );
for ( File file : files )
{
copyFileToDirectory( file, destinationDirectory );
}
}
代码示例来源:origin: apache/usergrid
FileUtils.copyFileToDirectory( f.getAbsolutePath(), targetFolder );
代码示例来源:origin: apache/usergrid
File resourceFile = new File( resFile );
LOG.info( "Copying {} to {}", resourceFile.getName(), targetFolder );
FileUtils.copyFileToDirectory( resourceFile, targetFolderFile );
代码示例来源:origin: apache/usergrid
" goal of the 'maven-jar-plugin' in your project's pom" );
FileUtils.copyFileToDirectory( new File( getProjectOutputJarPath() ), libPathFile );
FileUtils.copyFileToDirectory( new File( projectTestOutputJar ), libPathFile );
代码示例来源:origin: geotools/geotools
FileUtils.copyFileToDirectory(jarFile, collect);
Set<Artifact> dependencies = project.getDependencyArtifacts();
if (dependencies != null) {
FileUtils.copyFileToDirectory(file, collect);
代码示例来源:origin: geotools/geotools
final File nodeFile = (File) it.next();
try {
FileUtils.copyFileToDirectory(nodeFile, outputPackageDirectory);
} catch (IOException e) {
throw new MojoExecutionException("Failed to copy Node.java files for JJTree.", e);
FileUtils.copyFileToDirectory(sourceFile, new File(timestampDirectory));
} catch (IOException e) {
throw new MojoExecutionException("Failed to copy processed .jjt file.", e);
FileUtils.copyFileToDirectory(sourceFile, new File(timestampDirectory));
} catch (IOException e) {
throw new MojoExecutionException("Failed to copy processed .jj file.", e);
代码示例来源:origin: org.sonatype.maven.archetype/archetype-common
private void copyPom(File basedir, File replicaFilesDirectory) throws IOException {
FileUtils.copyFileToDirectory(new File(basedir, Constants.ARCHETYPE_POM), replicaFilesDirectory);
}
代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core
/**
* Copy file from source to destination. If <code>destinationDirectory</code> does not exist, it
* (and any parent directories) will be created. If a file <code>source</code> in
* <code>destinationDirectory</code> exists, it will be overwritten.
*
* @param source An existing <code>File</code> to copy.
* @param destinationDirectory A directory to copy <code>source</code> into.
* @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file.
* @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory.
* @throws IOException if <code>source</code> does not exist, the file in
* <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying.
*/
public static void copyFileToDirectory( final String source, final String destinationDirectory )
throws IOException
{
copyFileToDirectory( new File( source ), new File( destinationDirectory ) );
}
代码示例来源:origin: org.codehaus.plexus/plexus-runtime-builder
protected void copyArtifact( Artifact artifact, File outputDir, File destination )
throws IOException
{
String dest = destination.getAbsolutePath().substring( outputDir.getAbsolutePath().length() + 1 );
getLogger().info( "Adding " + artifact.getId() + " to " + dest );
FileUtils.copyFileToDirectory( artifact.getFile(), destination );
}
代码示例来源:origin: org.codehaus.mojo/wagon-maven-plugin
private void updateMavenLib( Artifact artifact )
throws MojoExecutionException
{
try
{
File mavenLibDir = new File( System.getProperty( "maven.home" ), "lib/ext" );
artifactResolver.resolve( artifact, remoteRepositories, localRepository );
this.getLog().info( "Copy " + artifact.getFile() + " to " + mavenLibDir );
FileUtils.copyFileToDirectory( artifact.getFile(), mavenLibDir );
}
catch ( Exception e )
{
throw new MojoExecutionException( "Unable to download artifact", e );
}
}
}
代码示例来源:origin: org.codehaus.plexus/plexus-appserver-runtime-builder
protected void copyArtifact( Artifact artifact, File outputDir, File destination )
throws IOException
{
String dest = destination.getAbsolutePath().substring( outputDir.getAbsolutePath().length() + 1 );
getLogger().info( "Adding " + artifact.getId() + " to " + dest );
FileUtils.copyFileToDirectory( artifact.getFile(), destination );
}
代码示例来源:origin: org.apache.servicemix.kernel.gshell/org.apache.servicemix.kernel.gshell.core
public static void copyDirectory( File sourceDirectory, File destinationDirectory, String includes,
String excludes )
throws IOException
{
if ( !sourceDirectory.exists() )
{
return;
}
List files = getFiles( sourceDirectory, includes, excludes );
for ( Iterator i = files.iterator(); i.hasNext(); )
{
File file = (File) i.next();
copyFileToDirectory( file, destinationDirectory );
}
}
代码示例来源:origin: org.codehaus.tycho/maven-osgi-packaging-plugin
public void execute() throws MojoExecutionException {
try {
File out = new File(project.getBasedir(), jars);
for (Iterator i = getIncludedArtifacts().iterator(); i.hasNext(); ) {
Artifact a = (Artifact) i.next();
FileUtils.copyFileToDirectory(a.getFile(), out);
}
if (packageSources) {
packageSources(getIncludedArtifacts());
}
Manifest manifest = getManifest();
File metaInf = new File(project.getBasedir(), "META-INF");
metaInf.mkdirs();
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(new File(metaInf, "MANIFEST.MF")));
manifest.write(os);
os.close();
// packageBundle();
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
代码示例来源:origin: org.codehaus.plexus/plexus-runtime-builder
public void addPlexusApplication( File plexusApplication, File runtimeDirectory )
throws PlexusRuntimeBuilderException
{
try
{
FileUtils.copyFileToDirectory( plexusApplication, getAppsDirectory( runtimeDirectory ) );
}
catch ( IOException e )
{
throw new PlexusRuntimeBuilderException( "Error while copying the application into the runtime.", e );
}
}
代码示例来源:origin: org.codehaus.plexus/plexus-appserver-runtime-builder
public void addPlexusApplication( File plexusApplication, File runtimeDirectory )
throws PlexusRuntimeBuilderException
{
try
{
FileUtils.copyFileToDirectory( plexusApplication, getAppsDirectory( runtimeDirectory ) );
}
catch ( IOException e )
{
throw new PlexusRuntimeBuilderException( "Error while copying the appserver into the runtime.", e );
}
}
代码示例来源:origin: org.apache.npanday/dotnet-executable
private void moveInteropDllToBuildDirectory(Artifact artifact) throws PlatformUnsupportedException
{
try
{
File file = artifact.getFile();
String oldPath = file.getAbsolutePath();
String target = project.getBuild().getDirectory();
String newPath = target + File.separator + "Interop." + artifact.getArtifactId() + ".dll";
if ( oldPath.contains( target ) ) //already copied to target
return ;
logger.info( "NPANDAY-000-000:[COM Reference] copying file ["+ oldPath+"] to [" + target +"]" );
FileUtils.copyFileToDirectory( file, new File( target ) );
logger.info( "NPANDAY-000-000:[COM Reference] deleting directory ["+ file.getParentFile() +"]" );
FileUtils.deleteDirectory( file.getParentFile() );
logger.info( "NPANDAY-000-000:[COM Reference] updating artifact path to ["+ newPath +"]" );
artifact.setFile( new File( newPath ) );
}catch(Exception e)
{
throw new PlatformUnsupportedException (e);
}
}
代码示例来源:origin: com.paypal.butterfly/butterfly-utilities
@Override
protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) {
File fileFrom = getAbsoluteFile(transformedAppFolder, transformationContext);
File fileTo = getFileTo(transformedAppFolder, transformationContext);
TOExecutionResult result = null;
try {
String details = String.format("File '%s' has been copied to '%s'", getRelativePath(), getRelativePath(transformedAppFolder, fileTo));
FileUtils.copyFileToDirectory(fileFrom, fileTo);
result = TOExecutionResult.success(this, details);
} catch (IOException e) {
result = TOExecutionResult.error(this, e);
}
return result;
}
代码示例来源:origin: com.paypal.butterfly/butterfly-utilities
@Override
protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) {
File fileFrom = getAbsoluteFile(transformedAppFolder, transformationContext);
File fileTo = getFileTo(transformedAppFolder, transformationContext);
TOExecutionResult result = null;
// TODO
// Check if it is really a file and if it exists!
try {
String details = String.format("File '%s' has been moved to '%s'", getRelativePath(), getRelativePath(transformedAppFolder, fileTo));
FileUtils.copyFileToDirectory(fileFrom, fileTo);
FileUtils.fileDelete(fileFrom.getAbsolutePath());
result = TOExecutionResult.success(this, details);
} catch (IOException e) {
result = TOExecutionResult.error(this, e);
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!