You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by st...@apache.org on 2011/12/13 17:12:28 UTC

svn commit: r1213763 - in /maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec: ForkedMavenExecutor.java InvokerMavenExecutor.java

Author: stephenc
Date: Tue Dec 13 16:12:28 2011
New Revision: 1213763

URL: http://svn.apache.org/viewvc?rev=1213763&view=rev
Log:
[MRELEASE-577] release:prepare does not pass argument --settings with current settings.xml to inner maven.

o Should be fixed by this, need to figure out a good way to confirm the fix in an integration test though.

Modified:
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java?rev=1213763&r1=1213762&r2=1213763&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java (original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java Tue Dec 13 16:12:28 2011
@@ -19,13 +19,16 @@ package org.apache.maven.shared.release.
  * under the License.
  */
 
+import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
 import org.apache.maven.shared.release.ReleaseResult;
 import org.apache.maven.shared.release.env.ReleaseEnvironment;
+import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.cli.Commandline;
 
 import java.io.File;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -49,12 +52,8 @@ public class ForkedMavenExecutor
     /**
      * @noinspection UseOfSystemOutOrSystemErr
      */
-    public void executeGoals( File workingDirectory,
-                              String goals,
-                              ReleaseEnvironment releaseEnvironment,
-                              boolean interactive,
-                              String additionalArguments,
-                              String pomFileName,
+    public void executeGoals( File workingDirectory, String goals, ReleaseEnvironment releaseEnvironment,
+                              boolean interactive, String additionalArguments, String pomFileName,
                               ReleaseResult relResult )
         throws MavenExecutorException
     {
@@ -68,79 +67,115 @@ public class ForkedMavenExecutor
         {
             mavenPath = System.getProperty( "maven.home" );
         }
-       
-        Commandline cl = commandLineFactory.createCommandLine( mavenPath + File.separator + "bin" + File.separator
-            + "mvn" );
 
-        cl.setWorkingDirectory( workingDirectory.getAbsolutePath() );
-
-        cl.addEnvironment( "MAVEN_TERMINATE_CMD", "on" );
-        
-        cl.addEnvironment( "M2_HOME", mavenPath );
-
-        if ( pomFileName != null )
+        File settingsFile = null;
+        if ( releaseEnvironment.getSettings() != null )
         {
-            cl.createArg().setLine( "-f " + pomFileName );
+            // Have to serialize to a file as if Maven is embedded, there may not actually be a settings.xml on disk
+            try
+            {
+                settingsFile = File.createTempFile( "release-settings", ".xml" );
+                SettingsXpp3Writer writer = new SettingsXpp3Writer();
+                FileWriter fileWriter = null;
+                try
+                {
+                    fileWriter = new FileWriter( settingsFile );
+                    writer.write( fileWriter, releaseEnvironment.getSettings() );
+                }
+                finally
+                {
+                    IOUtil.close( fileWriter );
+                }
+            }
+            catch ( IOException e )
+            {
+                throw new MavenExecutorException( "Could not create temporary file for release settings.xml", e );
+            }
         }
-
-        if ( goals != null )
+        try
         {
-            // accept both space and comma, so the old way still work
-            // also accept line separators, so that goal lists can be spread
-            // across multiple lines in the POM.
-            String[] tokens = StringUtils.split( goals, ", \n\r" );
 
-            for ( int i = 0; i < tokens.length; ++i )
+            Commandline cl =
+                commandLineFactory.createCommandLine( mavenPath + File.separator + "bin" + File.separator + "mvn" );
+
+            cl.setWorkingDirectory( workingDirectory.getAbsolutePath() );
+
+            cl.addEnvironment( "MAVEN_TERMINATE_CMD", "on" );
+
+            cl.addEnvironment( "M2_HOME", mavenPath );
+
+            if ( settingsFile != null )
             {
-                cl.createArg().setValue( tokens[i] );
+                cl.createArg().setLine( "-s " + settingsFile.getAbsolutePath() );
             }
-        }
 
-        cl.createArg().setValue( "--no-plugin-updates" );
+            if ( pomFileName != null )
+            {
+                cl.createArg().setLine( "-f " + pomFileName );
+            }
 
-        if ( !interactive )
-        {
-            cl.createArg().setValue( "--batch-mode" );
-        }
+            if ( goals != null )
+            {
+                // accept both space and comma, so the old way still work
+                // also accept line separators, so that goal lists can be spread
+                // across multiple lines in the POM.
+                String[] tokens = StringUtils.split( goals, ", \n\r" );
 
-        if ( !StringUtils.isEmpty( additionalArguments ) )
-        {
-            cl.createArg().setLine( additionalArguments );
-        }
+                for ( int i = 0; i < tokens.length; ++i )
+                {
+                    cl.createArg().setValue( tokens[i] );
+                }
+            }
 
-        TeeOutputStream stdOut = new TeeOutputStream( System.out );
+            cl.createArg().setValue( "--no-plugin-updates" );
 
-        TeeOutputStream stdErr = new TeeOutputStream( System.err );
+            if ( !interactive )
+            {
+                cl.createArg().setValue( "--batch-mode" );
+            }
 
-        try
-        {
-            relResult.appendInfo( "Executing: " + cl.toString() );
-            getLogger().info( "Executing: " + cl.toString() );
+            if ( !StringUtils.isEmpty( additionalArguments ) )
+            {
+                cl.createArg().setLine( additionalArguments );
+            }
+
+            TeeOutputStream stdOut = new TeeOutputStream( System.out );
+
+            TeeOutputStream stdErr = new TeeOutputStream( System.err );
+
+            try
+            {
+                relResult.appendInfo( "Executing: " + cl.toString() );
+                getLogger().info( "Executing: " + cl.toString() );
 
-            int result = executeCommandLine( cl, System.in, stdOut, stdErr );
+                int result = executeCommandLine( cl, System.in, stdOut, stdErr );
 
-            if ( result != 0 )
+                if ( result != 0 )
+                {
+                    throw new MavenExecutorException( "Maven execution failed, exit code: \'" + result + "\'", result,
+                                                      stdOut.toString(), stdErr.toString() );
+                }
+            }
+            catch ( CommandLineException e )
             {
-                throw new MavenExecutorException( "Maven execution failed, exit code: \'" + result + "\'", result,
-                                                  stdOut.toString(), stdErr.toString() );
+                throw new MavenExecutorException( "Can't run goal " + goals, stdOut.toString(), stdErr.toString(), e );
+            }
+            finally
+            {
+                relResult.appendOutput( stdOut.toString() );
             }
-        }
-        catch ( CommandLineException e )
-        {
-            throw new MavenExecutorException( "Can't run goal " + goals, stdOut.toString(), stdErr.toString(), e );
         }
         finally
         {
-            relResult.appendOutput( stdOut.toString() );
+            if ( settingsFile != null && settingsFile.exists() && !settingsFile.delete() )
+            {
+                settingsFile.deleteOnExit();
+            }
         }
     }
 
-    public void executeGoals( File workingDirectory,
-                              String goals,
-                              ReleaseEnvironment releaseEnvironment,
-                              boolean interactive,
-                              String arguments,
-                              ReleaseResult result )
+    public void executeGoals( File workingDirectory, String goals, ReleaseEnvironment releaseEnvironment,
+                              boolean interactive, String arguments, ReleaseResult result )
         throws MavenExecutorException
     {
         executeGoals( workingDirectory, goals, interactive, arguments, null, result );
@@ -152,10 +187,8 @@ public class ForkedMavenExecutor
     }
 
 
-
-
-    public static int executeCommandLine( Commandline cl, InputStream systemIn,
-                                          OutputStream systemOut, OutputStream systemErr )
+    public static int executeCommandLine( Commandline cl, InputStream systemIn, OutputStream systemOut,
+                                          OutputStream systemErr )
         throws CommandLineException
     {
         if ( cl == null )

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java?rev=1213763&r1=1213762&r2=1213763&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java (original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java Tue Dec 13 16:12:28 2011
@@ -23,6 +23,7 @@ import org.apache.commons.cli.CommandLin
 import org.apache.commons.cli.OptionBuilder;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.PosixParser;
+import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
 import org.apache.maven.shared.invoker.DefaultInvocationRequest;
 import org.apache.maven.shared.invoker.DefaultInvoker;
 import org.apache.maven.shared.invoker.InvocationOutputHandler;
@@ -34,10 +35,13 @@ import org.apache.maven.shared.invoker.M
 import org.apache.maven.shared.release.ReleaseResult;
 import org.apache.maven.shared.release.env.ReleaseEnvironment;
 import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 
 import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -95,89 +99,69 @@ public class InvokerMavenExecutor
 
     static
     {
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "define" )
-                                        .hasArg()
-                                        .withDescription( "Define a system property" )
-                                        .create( SET_SYSTEM_PROPERTY ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "offline" )
-                                        .withDescription( "Work offline" )
-                                        .create( OFFLINE ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "quiet" )
-                                        .withDescription( "Quiet output - only show errors" )
-                                        .create( QUIET ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "debug" )
-                                        .withDescription( "Produce execution debug output" )
-                                        .create( DEBUG ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "errors" )
-                                        .withDescription( "Produce execution error messages" )
-                                        .create( ERRORS ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "reactor" )
-                                        .withDescription( "Execute goals for project found in the reactor" )
-                                        .create( REACTOR ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "non-recursive" )
-                                        .withDescription( "Do not recurse into sub-projects" )
-                                        .create( NON_RECURSIVE ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "update-snapshots" )
-                                        .withDescription( "Forces a check for updated releases and snapshots on remote repositories" )
-                                        .create( UPDATE_SNAPSHOTS ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "activate-profiles" )
-                                        .withDescription( "Comma-delimited list of profiles to activate" )
-                                        .hasArg()
-                                        .create( ACTIVATE_PROFILES ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "check-plugin-updates" )
-                                        .withDescription( "Force upToDate check for any relevant registered plugins" )
-                                        .create( FORCE_PLUGIN_UPDATES ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "update-plugins" )
-                                        .withDescription( "Synonym for " + FORCE_PLUGIN_UPDATES )
-                                        .create( FORCE_PLUGIN_UPDATES2 ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "no-plugin-updates" )
-                                        .withDescription( "Suppress upToDate check for any relevant registered plugins" )
-                                        .create( SUPPRESS_PLUGIN_UPDATES ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" )
-                                        .withDescription( "Don't use ~/.m2/plugin-registry.xml for plugin versions" )
-                                        .create( SUPPRESS_PLUGIN_REGISTRY ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "strict-checksums" )
-                                        .withDescription( "Fail the build if checksums don't match" )
-                                        .create( CHECKSUM_FAILURE_POLICY ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "lax-checksums" )
-                                        .withDescription( "Warn if checksums don't match" )
-                                        .create( CHECKSUM_WARNING_POLICY ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "settings" )
-                                        .withDescription( "Alternate path for the user settings file" ).hasArg()
-                                        .create( ALTERNATE_USER_SETTINGS ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "fail-fast" )
-                                        .withDescription( "Stop at first failure in reactorized builds" )
-                                        .create( FAIL_FAST ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "fail-at-end" )
-                                        .withDescription( "Only fail the build afterwards; allow all non-impacted builds to continue" )
-                                        .create( FAIL_AT_END ) );
-
-        OPTIONS.addOption( OptionBuilder.withLongOpt( "fail-never" )
-                                        .withDescription( "NEVER fail the build, regardless of project result" )
-                                        .create( FAIL_NEVER ) );
+        OPTIONS.addOption(
+            OptionBuilder.withLongOpt( "define" ).hasArg().withDescription( "Define a system property" ).create(
+                SET_SYSTEM_PROPERTY ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "offline" ).withDescription( "Work offline" ).create( OFFLINE ) );
+
+        OPTIONS.addOption(
+            OptionBuilder.withLongOpt( "quiet" ).withDescription( "Quiet output - only show errors" ).create( QUIET ) );
+
+        OPTIONS.addOption(
+            OptionBuilder.withLongOpt( "debug" ).withDescription( "Produce execution debug output" ).create( DEBUG ) );
+
+        OPTIONS.addOption(
+            OptionBuilder.withLongOpt( "errors" ).withDescription( "Produce execution error messages" ).create(
+                ERRORS ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "reactor" ).withDescription(
+            "Execute goals for project found in the reactor" ).create( REACTOR ) );
+
+        OPTIONS.addOption(
+            OptionBuilder.withLongOpt( "non-recursive" ).withDescription( "Do not recurse into sub-projects" ).create(
+                NON_RECURSIVE ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "update-snapshots" ).withDescription(
+            "Forces a check for updated releases and snapshots on remote repositories" ).create( UPDATE_SNAPSHOTS ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "activate-profiles" ).withDescription(
+            "Comma-delimited list of profiles to activate" ).hasArg().create( ACTIVATE_PROFILES ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "check-plugin-updates" ).withDescription(
+            "Force upToDate check for any relevant registered plugins" ).create( FORCE_PLUGIN_UPDATES ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "update-plugins" ).withDescription(
+            "Synonym for " + FORCE_PLUGIN_UPDATES ).create( FORCE_PLUGIN_UPDATES2 ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "no-plugin-updates" ).withDescription(
+            "Suppress upToDate check for any relevant registered plugins" ).create( SUPPRESS_PLUGIN_UPDATES ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription(
+            "Don't use ~/.m2/plugin-registry.xml for plugin versions" ).create( SUPPRESS_PLUGIN_REGISTRY ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "strict-checksums" ).withDescription(
+            "Fail the build if checksums don't match" ).create( CHECKSUM_FAILURE_POLICY ) );
+
+        OPTIONS.addOption(
+            OptionBuilder.withLongOpt( "lax-checksums" ).withDescription( "Warn if checksums don't match" ).create(
+                CHECKSUM_WARNING_POLICY ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "settings" ).withDescription(
+            "Alternate path for the user settings file" ).hasArg().create( ALTERNATE_USER_SETTINGS ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "fail-fast" ).withDescription(
+            "Stop at first failure in reactorized builds" ).create( FAIL_FAST ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "fail-at-end" ).withDescription(
+            "Only fail the build afterwards; allow all non-impacted builds to continue" ).create( FAIL_AT_END ) );
+
+        OPTIONS.addOption( OptionBuilder.withLongOpt( "fail-never" ).withDescription(
+            "NEVER fail the build, regardless of project result" ).create( FAIL_NEVER ) );
     }
 
     // TODO: Configuring an invocation request from a command line could as well be part of the Invoker API
-    private void setupRequest( InvocationRequest req,
-                               LoggerBridge bridge,
-                               String additionalArguments )
+    private void setupRequest( InvocationRequest req, LoggerBridge bridge, String additionalArguments )
         throws MavenExecutorException
     {
         try
@@ -277,10 +261,9 @@ public class InvokerMavenExecutor
 
                 if ( !deactivatedProfiles.isEmpty() )
                 {
-                    getLogger().warn(
-                                      "Explicit profile deactivation is not yet supported. "
-                                          + "The following profiles will NOT be deactivated: "
-                                          + StringUtils.join( deactivatedProfiles.iterator(), ", " ) );
+                    getLogger().warn( "Explicit profile deactivation is not yet supported. "
+                                          + "The following profiles will NOT be deactivated: " + StringUtils.join(
+                        deactivatedProfiles.iterator(), ", " ) );
                 }
 
                 if ( !activatedProfiles.isEmpty() )
@@ -336,91 +319,103 @@ public class InvokerMavenExecutor
         }
     }
 
-    public void executeGoals( File workingDirectory,
-                              String goals,
-                              ReleaseEnvironment releaseEnvironment,
-                              boolean interactive,
-                              String additionalArguments,
-                              String pomFileName,
+    public void executeGoals( File workingDirectory, String goals, ReleaseEnvironment releaseEnvironment,
+                              boolean interactive, String additionalArguments, String pomFileName,
                               ReleaseResult result )
         throws MavenExecutorException
     {
         Handler handler = new Handler( getLogger() );
         LoggerBridge bridge = new LoggerBridge( getLogger() );
 
-        Invoker invoker = new DefaultInvoker().setMavenHome( releaseEnvironment.getMavenHome() )
-                                              .setLogger( bridge )
-                                              .setOutputHandler( handler )
-                                              .setErrorHandler( handler );
-
-        InvocationRequest req = new DefaultInvocationRequest().setDebug( getLogger().isDebugEnabled() )
-                                                              .setBaseDirectory( workingDirectory )
-                                                              .setInteractive( interactive );
+        Invoker invoker =
+            new DefaultInvoker().setMavenHome( releaseEnvironment.getMavenHome() ).setLogger( bridge ).setOutputHandler(
+                handler ).setErrorHandler( handler );
+
+        InvocationRequest req =
+            new DefaultInvocationRequest().setDebug( getLogger().isDebugEnabled() ).setBaseDirectory(
+                workingDirectory ).setInteractive( interactive );
 
         if ( pomFileName != null )
         {
             req.setPomFileName( pomFileName );
         }
 
+        File settingsFile = null;
         if ( releaseEnvironment.getSettings() != null )
         {
-            // FIXME: This is effectively useless in Maven 2.x, since getFile() always returns null
-            File settingsFile = releaseEnvironment.getSettings().getRuntimeInfo().getFile();
-            if ( settingsFile != null && settingsFile.isFile() )
+            // Have to serialize to a file as if Maven is embedded, there may not actually be a settings.xml on disk
+            try
             {
+                settingsFile = File.createTempFile( "release-settings", ".xml" );
+                SettingsXpp3Writer writer = new SettingsXpp3Writer();
+                FileWriter fileWriter = null;
+                try
+                {
+                    fileWriter = new FileWriter( settingsFile );
+                    writer.write( fileWriter, releaseEnvironment.getSettings() );
+                }
+                finally
+                {
+                    IOUtil.close( fileWriter );
+                }
                 req.setUserSettingsFile( settingsFile );
             }
+            catch ( IOException e )
+            {
+                throw new MavenExecutorException( "Could not create temporary file for release settings.xml", e );
+            }
         }
-
-        File localRepoDir = releaseEnvironment.getLocalRepositoryDirectory();
-        if ( localRepoDir != null )
+        try
         {
-            req.setLocalRepositoryDirectory( localRepoDir );
-        }
-
-        setupRequest( req, bridge, additionalArguments );
+            File localRepoDir = releaseEnvironment.getLocalRepositoryDirectory();
+            if ( localRepoDir != null )
+            {
+                req.setLocalRepositoryDirectory( localRepoDir );
+            }
 
-        if ( goals.trim().length() > 0 )
-        {
-            String[] rawGoals = goals.split( " " );
-            req.setGoals( Arrays.asList( rawGoals ) );
-        }
+            setupRequest( req, bridge, additionalArguments );
 
-        try
-        {
-            InvocationResult invocationResult = invoker.execute( req );
+            if ( goals.trim().length() > 0 )
+            {
+                String[] rawGoals = goals.split( " " );
+                req.setGoals( Arrays.asList( rawGoals ) );
+            }
 
-            if ( invocationResult.getExecutionException() != null )
+            try
             {
-                throw new MavenExecutorException( "Error executing Maven.", invocationResult.getExecutionException() );
+                InvocationResult invocationResult = invoker.execute( req );
+
+                if ( invocationResult.getExecutionException() != null )
+                {
+                    throw new MavenExecutorException( "Error executing Maven.",
+                                                      invocationResult.getExecutionException() );
+                }
+                if ( invocationResult.getExitCode() != 0 )
+                {
+                    throw new MavenExecutorException(
+                        "Maven execution failed, exit code: \'" + invocationResult.getExitCode() + "\'",
+                        invocationResult.getExitCode(), "", "" );
+                }
             }
-            if ( invocationResult.getExitCode() != 0 )
+            catch ( MavenInvocationException e )
             {
-                throw new MavenExecutorException( "Maven execution failed, exit code: \'"
-                    + invocationResult.getExitCode() + "\'", invocationResult.getExitCode(), "", "" );
+                throw new MavenExecutorException( "Failed to invoke Maven build.", e );
             }
         }
-        catch ( MavenInvocationException e )
+        finally
         {
-            throw new MavenExecutorException( "Failed to invoke Maven build.", e );
+            if ( settingsFile != null && settingsFile.exists() && !settingsFile.delete() )
+            {
+                settingsFile.deleteOnExit();
+            }
         }
     }
 
-    public void executeGoals( File workingDirectory,
-                              String goals,
-                              ReleaseEnvironment releaseEnvironment,
-                              boolean interactive,
-                              String additionalArguments,
-                              ReleaseResult result )
+    public void executeGoals( File workingDirectory, String goals, ReleaseEnvironment releaseEnvironment,
+                              boolean interactive, String additionalArguments, ReleaseResult result )
         throws MavenExecutorException
     {
-        executeGoals( workingDirectory,
-                      goals,
-                      releaseEnvironment,
-                      interactive,
-                      additionalArguments,
-                      null,
-                      result );
+        executeGoals( workingDirectory, goals, releaseEnvironment, interactive, additionalArguments, null, result );
     }
 
     private static final class Handler
@@ -450,8 +445,7 @@ public class InvokerMavenExecutor
             this.logger = logger;
         }
 
-        public void debug( String message,
-                           Throwable error )
+        public void debug( String message, Throwable error )
         {
             logger.debug( message, error );
         }
@@ -461,8 +455,7 @@ public class InvokerMavenExecutor
             logger.debug( message );
         }
 
-        public void error( String message,
-                           Throwable error )
+        public void error( String message, Throwable error )
         {
             logger.error( message, error );
         }
@@ -472,8 +465,7 @@ public class InvokerMavenExecutor
             logger.error( message );
         }
 
-        public void fatalError( String message,
-                                Throwable error )
+        public void fatalError( String message, Throwable error )
         {
             logger.fatalError( message, error );
         }
@@ -498,8 +490,7 @@ public class InvokerMavenExecutor
             return logger.getThreshold();
         }
 
-        public void info( String message,
-                          Throwable error )
+        public void info( String message, Throwable error )
         {
             logger.info( message, error );
         }
@@ -541,8 +532,7 @@ public class InvokerMavenExecutor
             // is not supported in plexus-container-default:1.0-alpha-9 as used in Maven 2.x
         }
 
-        public void warn( String message,
-                          Throwable error )
+        public void warn( String message, Throwable error )
         {
             logger.warn( message, error );
         }