本文整理匯總了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());
}