src/main/java/org/codehaus/mojo/exec/ExecMojo.java
public void execute()
        throws MojoExecutionException
    {
        if ( executable == null )
        {
            if (executableDependency == null)
            {
                throw new MojoExecutionException( "The parameter 'executable' is missing or invalid" );
            }

            executable = findExecutableArtifact().getFile().getAbsolutePath();
            getLog().debug( "using executable dependency " + executable);
        }

        if ( isSkip() )
        {
            getLog().info( "skipping execute as per configuration" );
            return;
        }

        if ( basedir == null )
        {
            throw new IllegalStateException( "basedir is null. Should not be possible." );
        }

        try
        {

            handleWorkingDirectory();

            String argsProp = getSystemProperty( "exec.args" );

            List<String> commandArguments = new ArrayList<String>();

            if ( hasCommandlineArgs() )
            {
                handleCommandLineArgs( commandArguments );
            }
            else if ( !StringUtils.isEmpty( argsProp ) )
            {
                handleSystemPropertyArguments( argsProp, commandArguments );
            }
            else
            {
                if ( arguments != null )
                {
                    handleArguments( commandArguments );
                }
            }

            Map<String, String> enviro = handleSystemEnvVariables();

            CommandLine commandLine = getExecutablePath( enviro, workingDirectory );

            String[] args = commandArguments.toArray( new String[commandArguments.size()] );

            commandLine.addArguments( args, false );

            Executor exec = new DefaultExecutor();
            exec.setWorkingDirectory( workingDirectory );
            fillSuccessCodes( exec );

            getLog().debug( "Executing command line: " + commandLine );

            try
            {
                int resultCode;
                if ( outputFile != null )
                {
                    if ( !outputFile.getParentFile().exists() && !outputFile.getParentFile().mkdirs() )
                    {
                        getLog().warn( "Could not create non existing parent directories for log file: " + outputFile );
                    }

                    FileOutputStream outputStream = null;
                    try
                    {
                        outputStream = new FileOutputStream( outputFile );

                        resultCode = executeCommandLine( exec, commandLine, enviro, outputStream );
                    }
                    finally
                    {
                        IOUtil.close( outputStream );
                    }
                }
                else
                {
                    resultCode = executeCommandLine( exec, commandLine, enviro, System.out, System.err );
                }

                if ( isResultCodeAFailure( resultCode ) )
                {
                    String message = "Result of " + commandLine.toString() + " execution is: '" + resultCode + "'.";
                    getLog().error( message );
                    throw new MojoExecutionException( message );
                }
            }
            catch ( ExecuteException e )
            {
                getLog().error( "Command execution failed.", e );
                throw new MojoExecutionException( "Command execution failed.", e );
            }
            catch ( IOException e )
            {
                getLog().error( "Command execution failed.", e );
                throw new MojoExecutionException( "Command execution failed.", e );
            }

            registerSourceRoots();
        }
        catch ( IOException e )
        {
            throw new MojoExecutionException( "I/O Error", e );
        }
    }
public void execute()
        throws MojoExecutionException
    {
        if ( executable == null )
        {
            if (executableDependency == null)
            {
                throw new MojoExecutionException( "The parameter 'executable' is missing or invalid" );
            }

            executable = findExecutableArtifact().getFile().getAbsolutePath();
            getLog().debug( "using executable dependency " + executable);
        }

        if ( isSkip() )
        {
            getLog().info( "skipping execute as per configuration" );
            return;
        }

        if ( basedir == null )
        {
            throw new IllegalStateException( "basedir is null. Should not be possible." );
        }

        try
        {

            handleWorkingDirectory();

            String argsProp = getSystemProperty( "exec.args" );

            List<String> commandArguments = new ArrayList<String>();

            if ( hasCommandlineArgs() )
            {
                handleCommandLineArgs( commandArguments );
            }
            else if ( !StringUtils.isEmpty( argsProp ) )
            {
                handleSystemPropertyArguments( argsProp, commandArguments );
            }
            else
            {
                if ( arguments != null )
                {
                    handleArguments( commandArguments );
                }
            }

            Map<String, String> enviro = handleSystemEnvVariables();

            CommandLine commandLine = getExecutablePath( enviro, workingDirectory );

            String[] args = commandArguments.toArray( new String[commandArguments.size()] );

            commandLine.addArguments( args, false );

            Executor exec = new DefaultExecutor();
            exec.setWorkingDirectory( workingDirectory );
            fillSuccessCodes( exec );

            getLog().debug( "Executing command line: " + commandLine );

            try
            {
                int resultCode;
                if ( outputFile != null )
                {
                    if ( !outputFile.getParentFile().exists() && !outputFile.getParentFile().mkdirs() )
                    {
                        getLog().warn( "Could not create non existing parent directories for log file: " + outputFile );
                    }

                    FileOutputStream outputStream = null;
                    try
                    {
                        outputStream = new FileOutputStream( outputFile );

                        resultCode = executeCommandLine( exec, commandLine, enviro, outputStream );
                    }
                    finally
                    {
                        IOUtil.close( outputStream );
                    }
                }
                else
                {
                    resultCode = executeCommandLine( exec, commandLine, enviro, System.out, System.err );
                }

                if ( isResultCodeAFailure( resultCode ) )
                {
                    String message = "Result of " + commandLine.toString() + " execution is: '" + resultCode + "'.";
                    getLog().error( message );
                    throw new MojoExecutionException( message );
                }
            }
            catch ( ExecuteException e )
            {
                getLog().error( "Command execution failed.", e );
                throw new MojoExecutionException( "Command execution failed.", e );
            }
            catch ( IOException e )
            {
                getLog().error( "Command execution failed.", e );
                throw new MojoExecutionException( "Command execution failed.", e );
            }

            registerSourceRoots();
        }
        catch ( IOException e )
        {
            throw new MojoExecutionException( "I/O Error", e );
        }
    }
public void execute ( ) throws MojoExecutionException { if ( executable == null ) { if ( executableDependency == null ) { throw new MojoExecutionException ( "The parameter 'executable' is missing or invalid" ) ; } executable = findExecutableArtifact ( ) . getFile ( ) . getAbsolutePath ( ) ; getLog ( ) . debug ( "using executable dependency " + executable ) ; } if ( isSkip ( ) ) { getLog ( ) . info ( "skipping execute as per configuration" ) ; return ; } if ( basedir == null ) { throw new IllegalStateException ( "basedir is null. Should not be possible." ) ; } try { handleWorkingDirectory ( ) ; String argsProp = getSystemProperty ( "exec.args" ) ; List < String > commandArguments = new ArrayList < String > ( ) ; if ( hasCommandlineArgs ( ) ) { handleCommandLineArgs ( commandArguments ) ; } else if ( ! StringUtils . isEmpty ( argsProp ) ) { handleSystemPropertyArguments ( argsProp , commandArguments ) ; } else { if ( arguments != null ) { handleArguments ( commandArguments ) ; } } Map < String , String > enviro = handleSystemEnvVariables ( ) ; CommandLine commandLine = getExecutablePath ( enviro , workingDirectory ) ; String [ ] args = commandArguments . toArray ( new String [ commandArguments . size ( ) ] ) ; commandLine . addArguments ( args , false ) ; Executor exec = new DefaultExecutor ( ) ; exec . setWorkingDirectory ( workingDirectory ) ; fillSuccessCodes ( exec ) ; getLog ( ) . debug ( "Executing command line: " + commandLine ) ; try { int resultCode ; if ( outputFile != null ) { if ( ! outputFile . getParentFile ( ) . exists ( ) && ! outputFile . getParentFile ( ) . mkdirs ( ) ) { getLog ( ) . warn ( "Could not create non existing parent directories for log file: " + outputFile ) ; } FileOutputStream outputStream = null ; try { outputStream = new FileOutputStream ( outputFile ) ; resultCode = executeCommandLine ( exec , commandLine , enviro , outputStream ) ; } finally { IOUtil . close ( outputStream ) ; } } else { resultCode = executeCommandLine ( exec , commandLine , enviro , System . out , System . err ) ; } if ( isResultCodeAFailure ( resultCode ) ) { String message = "Result of " + commandLine . toString ( ) + " execution is: '" + resultCode + "'." ; getLog ( ) . error ( message ) ; throw new MojoExecutionException ( message ) ; } } catch ( ExecuteException e ) { getLog ( ) . error ( "Command execution failed." , e ) ; throw new MojoExecutionException ( "Command execution failed." , e ) ; } catch ( IOException e ) { getLog ( ) . error ( "Command execution failed." , e ) ; throw new MojoExecutionException ( "Command execution failed." , e ) ; } registerSourceRoots ( ) ; } catch ( IOException e ) { throw new MojoExecutionException ( "I/O Error" , e ) ; } }
priority in the execute method will be to use System properties arguments over the pom specification.

@throws MojoExecutionException if a failure happens
priority in the execute method will be to use System properties arguments over the pom specification .