本文整理汇总了Java中org.codehaus.plexus.util.FileUtils.fileDelete方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.fileDelete方法的具体用法?Java FileUtils.fileDelete怎么用?Java FileUtils.fileDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.plexus.util.FileUtils
的用法示例。
在下文中一共展示了FileUtils.fileDelete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execution
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
@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;
}
示例2: reset
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
@Override
public void reset() throws Exception {
logInfo("Starting RESET " + getName());
// Remove the output zip file
final File path = new File(config.getProperty("source.data.dir") + "/"
+ getProcess().getInputPath());
logInfo(" path " + path);
final String filename = getProcess().getVersion() + ".zip";
final File zipFile =
new File(path, getProcess().getVersion() + "/" + filename);
if (zipFile.exists()) {
FileUtils.fileDelete(zipFile.getAbsolutePath());
}
logInfo("Finished RESET " + getName());
}
开发者ID:WestCoastInformatics,项目名称:UMLS-Terminology-Server,代码行数:18,代码来源:PackageRrfReleaseAlgorithm.java
示例3: testIt7
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
/**
* Builds the it7 test project.
* @throws Exception The test failed.
*/
public void testIt7()
throws Exception
{
final File dir = new File( "src/test/it7" );
final File target = new File( dir, "target/generated-resources/xml/xslt/doc1.xml" );
TransformMojo mojo = (TransformMojo) newMojo( dir.getPath() );
FileUtils.fileDelete( target.getPath() );
mojo.execute();
String result = read( target );
assertFalse( result.startsWith( "<?xml" ) );
mojo = (TransformMojo) newMojo( "src/test/it7" );
TransformationSet[] transformationSets =
(TransformationSet[]) getVariableValueFromObject( mojo, "transformationSets" );
transformationSets[0].getOutputProperties()[0].setValue( "no" );
FileUtils.fileDelete( target.getPath() );
mojo.execute();
result = read( target );
assertTrue( result.startsWith( "<?xml" ) );
}
示例4: testBuildConfigFile
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
/**
*
* @throws Exception
*/
public void testBuildConfigFile()
{
final File baseDir = new File(".");
final String fileName = "test.lst";
final String fileAbsolutePath = baseDir.getAbsolutePath() + File.separator + fileName;
List args = new ArrayList();
args.add("-classpath");
args.add("a:b:c");
args.add("-showWeaveInfo");
args.add("/home/aspectj/AFile");
args.add("/home/aspectj/AnotherFile");
try
{
AjcHelper.writeBuildConfigToFile(args,fileName,baseDir);
assertTrue("Config file not written to disk",FileUtils.fileExists(fileAbsolutePath));
List readArgs = AjcHelper.readBuildConfigFile(fileName,baseDir);
assertEquals(args,readArgs);
} catch (Exception e)
{
fail("Unexpected exception: " + e.toString());
if (FileUtils.fileExists(fileAbsolutePath))
{
FileUtils.fileDelete(fileAbsolutePath);
}
}
}
示例5: testModificationSet
import org.codehaus.plexus.util.FileUtils; //导入方法依赖的package包/类
/**
* @throws Exception
*/
public void testModificationSet()
throws Exception
{
ajcMojo.aspectDirectory = "src/main/aspect";
final String[] includes = new String[]{"org/codehaus/mojo/aspectj/OldStyleAspect.aj"};
ajcMojo.setArgumentFileName("builddef.lst");
FileUtils.fileDelete(project.getBuild().getDirectory() + ajcMojo.argumentFileName);
ajcMojo.includes= new String[]{"org/codehaus/mojo/aspectj/OldStyleAspect.aj"};
ajcMojo.assembleArguments();
assertTrue("Build should be needed when no previous files are found",ajcMojo.isBuildNeeded());
try
{
ajcMojo.ajcOptions.clear();
ajcMojo.includes = includes;
ajcMojo.execute();
}
catch ( CompilationFailedException cfe )
{
// we're only testing modifications, don't care if it won't compile
}
catch ( UnsupportedClassVersionError ucve )
{
// we're only testing modifications, don't care if it won't compile
}
ajcMojo.ajcOptions.clear();
ajcMojo.includes = includes;
ajcMojo.assembleArguments();
assertFalse("A build has compleeted. No modifications done. no new build needed",ajcMojo.isBuildNeeded());
ajcMojo.ajcOptions.clear();
ajcMojo.includes = includes;
ajcMojo.setShowWeaveInfo(true);
ajcMojo.assembleArguments();
assertTrue("One of the arguments has changed, a new build is needed",ajcMojo.isBuildNeeded());
ajcMojo.ajcOptions.clear();
ajcMojo.includes = includes;
ajcMojo.assembleArguments();
assertFalse("A build has compleeted. No modifications done. no new build needed",ajcMojo.isBuildNeeded());
String currentDir = new File(".").getAbsolutePath();
File aspect = new File(currentDir.substring(0,currentDir.length()-1)+"src/test/projects/test-project/src/main/aspect/org/codehaus/mojo/aspectj/OldStyleAspect.aj");
long timeStamp = System.currentTimeMillis();
assertTrue("Could not touch file: " + aspect.getAbsolutePath(), aspect.setLastModified(timeStamp));
assertTrue("One of the included files has changed. a new build is needed",ajcMojo.isBuildNeeded());
}