public void execute()

in src/main/java/org/apache/maven/shared/verifier/Verifier.java [1283:1344]


    public void execute() throws VerificationException
    {

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

        Collections.addAll( args, defaultCliArguments );

        if ( this.mavenDebug )
        {
            args.add( "-X" );
        }

        /*
         * NOTE: Unless explicitly requested by the caller, the forked builds should use the current local
         * repository. Otherwise, the forked builds would in principle leave the sandbox environment which has been
         * setup for the current build. In particular, using "maven.repo.local" will make sure the forked builds use
         * the same local repo as the parent build even if a custom user settings is provided.
         */
        boolean useMavenRepoLocal = Boolean.valueOf( verifierProperties.getProperty( "use.mavenRepoLocal", "true" ) );

        if ( useMavenRepoLocal )
        {
            args.add( "-Dmaven.repo.local=" + localRepo );
        }

        if ( autoclean )
        {
            args.add( CLEAN_CLI_ARGUMENT );
        }

        for ( String cliArgument : cliArguments )
        {
            args.add( cliArgument.replace( "${basedir}", getBasedir() ) );
        }

        int ret;
        File logFile = new File( getBasedir(), getLogFileName() );

        try
        {
            MavenLauncher launcher = getMavenLauncher( environmentVariables );

            String[] cliArgs = args.toArray( new String[0] );
            ret = launcher.run( cliArgs, systemProperties, getBasedir(), logFile );
        }
        catch ( LauncherException e )
        {
            throw new VerificationException( "Failed to execute Maven", e );
        }
        catch ( IOException e )
        {
            throw new VerificationException( e );
        }

        if ( ret > 0 )
        {
            throw new VerificationException(
                "Exit code was non-zero: " + ret + "; command line and log = \n" + new File( mavenHome,
                                                                                             "bin/mvn" ) + " "
                    + StringUtils.join( args.iterator(), " " ) + "\n" + getLogContents( logFile ) );
        }
    }