You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/12/20 09:36:25 UTC
[maven-invoker-plugin] 18/22: use deleteOnExit() for temporary
interpolated pom files
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git
commit ed679269279c60ab7e88681eabaac9be3af270fc
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat Dec 1 22:10:12 2007 +0000
use deleteOnExit() for temporary interpolated pom files
git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@600202 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/maven/plugin/invoker/InvokerMojo.java | 39 +++-------------------
.../maven/plugin/invoker/InterpolationTest.java | 4 ---
2 files changed, 5 insertions(+), 38 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index 845ecad..543004c 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -241,9 +241,6 @@ public class InvokerMojo
* @since 1.1
*/
private String invokerTest;
-
- // list to store interpolated pom for delete at the end
- private List/*File*/ interpolatedPomFiles = new ArrayList();
public void execute()
throws MojoExecutionException, MojoFailureException
@@ -310,20 +307,13 @@ public class InvokerMojo
final List failures = new ArrayList();
- try
+ for ( int i = 0; i < includedPoms.length; i++ )
{
- for ( int i = 0; i < includedPoms.length; i++ )
- {
- final String pom = includedPoms[i];
+ final String pom = includedPoms[i];
- runBuild( projectsDir, pom, failures );
- }
- }
- finally
- {
- // interpolated files cleanup
- cleanupInterpolatedPomFiles();
+ runBuild( projectsDir, pom, failures );
}
+
if ( !suppressSummaries )
{
@@ -955,7 +945,7 @@ public class InvokerMojo
throws MojoExecutionException
{
File interpolatedPomFile = new File( targetDirectory, "interpolated-pom.xml" );
- interpolatedPomFiles.add( interpolatedPomFile );
+ interpolatedPomFile.deleteOnExit();
Map composite = new CompositeMap( this.project, this.interpolationsProperties );
try
@@ -1006,23 +996,4 @@ public class InvokerMojo
}
return interpolatedPomFile;
}
-
- private void cleanupInterpolatedPomFiles()
- {
- for ( Iterator iterator = this.interpolatedPomFiles.iterator(); iterator.hasNext(); )
- {
- File file = (File) iterator.next();
- if ( file.exists() )
- {
- try
- {
- FileUtils.forceDelete( file );
- } catch (IOException e)
- {
- getLog().warn( "fail to clean file " + file.getPath() );
- }
- }
- }
- }
-
}
diff --git a/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
index 9fd8166..26ed45b 100755
--- a/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
+++ b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
@@ -110,10 +110,6 @@ public class InterpolationTest
{
fileReader.close();
}
- if ( interpolatedPomFile != null )
- {
- interpolatedPomFile.delete();
- }
}
}
}
--
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.